File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
lib/Doctrine/ODM/MongoDB/Aggregation/Stage Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 16
16
use function strtolower ;
17
17
18
18
/**
19
+ * @psalm-import-type SortDirectionKeywords from Sort
19
20
* @psalm-type CountType = 'lowerBound'|'total'
20
21
* @psalm-type SortMetaKeywords = 'searchScore'
21
22
* @psalm-type SortMeta = array{'$meta': SortMetaKeywords}
23
+ * @psalm-type SortShape = array<string, int|SortMeta|SortDirectionKeywords>
22
24
* @psalm-type SearchStageExpression = array{
23
25
* '$search': object{
24
26
* index?: string,
@@ -143,6 +145,12 @@ public function returnStoredSource(bool $returnStoredSource = true): static
143
145
return $ this ;
144
146
}
145
147
148
+ /**
149
+ * @param array<string, int|string>|string $fieldName Field name or array of field/order pairs
150
+ * @param int|string $order Field order (if one field is specified)
151
+ * @psalm-param SortShape|string $fieldName
152
+ * @psalm-param int|SortMeta|SortDirectionKeywords|null $order
153
+ */
146
154
public function sort ($ fieldName , $ order = null ): static
147
155
{
148
156
$ allowedMetaSort = ['searchScore ' ];
Original file line number Diff line number Diff line change 6
6
7
7
use Doctrine \ODM \MongoDB \Aggregation \Stage ;
8
8
use Doctrine \ODM \MongoDB \Aggregation \Stage \Search ;
9
+ use Doctrine \ODM \MongoDB \Aggregation \Stage \Sort ;
9
10
10
- /** @internal */
11
+ /**
12
+ * @internal
13
+ *
14
+ * @psalm-import-type SortDirectionKeywords from Sort
15
+ * @psalm-import-type SortMetaKeywords from Search
16
+ * @psalm-import-type SortMeta from Search
17
+ * @psalm-import-type SortShape from Search
18
+ */
11
19
abstract class AbstractSearchOperator extends Stage implements SearchOperator
12
20
{
13
21
public function __construct (private Search $ search )
@@ -35,6 +43,12 @@ public function returnStoredSource(bool $returnStoredSource): Search
35
43
return $ this ->search ->returnStoredSource ($ returnStoredSource );
36
44
}
37
45
46
+ /**
47
+ * @param array<string, int|string>|string $fieldName Field name or array of field/order pairs
48
+ * @param int|string $order Field order (if one field is specified)
49
+ * @psalm-param SortShape|string $fieldName
50
+ * @psalm-param int|SortMeta|SortDirectionKeywords|null $order
51
+ */
38
52
public function sort ($ fieldName , $ order = null ): Search
39
53
{
40
54
return $ this ->search ->sort ($ fieldName , $ order );
Original file line number Diff line number Diff line change 5
5
<code >IteratorAggregate</code >
6
6
</MissingTemplateParam >
7
7
</file >
8
+ <file src =" lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search.php" >
9
+ <MoreSpecificImplementedParamType >
10
+ <code >$fieldName</code >
11
+ <code >$order</code >
12
+ </MoreSpecificImplementedParamType >
13
+ </file >
14
+ <file src =" lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/AbstractSearchOperator.php" >
15
+ <MoreSpecificImplementedParamType >
16
+ <code >$fieldName</code >
17
+ <code >$order</code >
18
+ </MoreSpecificImplementedParamType >
19
+ </file >
8
20
<file src =" lib/Doctrine/ODM/MongoDB/Configuration.php" >
9
21
<TypeDoesNotContainType >
10
22
<code ><![CDATA[ $reflectionClass->implementsInterface(ClassMetadataFactoryInterface::class)]]> </code >
You can’t perform that action at this time.
0 commit comments