Skip to content

Commit b0f2ba5

Browse files
committed
Add missing phpdoc
1 parent 6fa3a0c commit b0f2ba5

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
use function strtolower;
1717

1818
/**
19+
* @psalm-import-type SortDirectionKeywords from Sort
1920
* @psalm-type CountType = 'lowerBound'|'total'
2021
* @psalm-type SortMetaKeywords = 'searchScore'
2122
* @psalm-type SortMeta = array{'$meta': SortMetaKeywords}
23+
* @psalm-type SortShape = array<string, int|SortMeta|SortDirectionKeywords>
2224
* @psalm-type SearchStageExpression = array{
2325
* '$search': object{
2426
* index?: string,
@@ -143,6 +145,12 @@ public function returnStoredSource(bool $returnStoredSource = true): static
143145
return $this;
144146
}
145147

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+
*/
146154
public function sort($fieldName, $order = null): static
147155
{
148156
$allowedMetaSort = ['searchScore'];

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/AbstractSearchOperator.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@
66

77
use Doctrine\ODM\MongoDB\Aggregation\Stage;
88
use Doctrine\ODM\MongoDB\Aggregation\Stage\Search;
9+
use Doctrine\ODM\MongoDB\Aggregation\Stage\Sort;
910

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+
*/
1119
abstract class AbstractSearchOperator extends Stage implements SearchOperator
1220
{
1321
public function __construct(private Search $search)
@@ -35,6 +43,12 @@ public function returnStoredSource(bool $returnStoredSource): Search
3543
return $this->search->returnStoredSource($returnStoredSource);
3644
}
3745

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+
*/
3852
public function sort($fieldName, $order = null): Search
3953
{
4054
return $this->search->sort($fieldName, $order);

psalm-baseline.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
<code>IteratorAggregate</code>
66
</MissingTemplateParam>
77
</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>
820
<file src="lib/Doctrine/ODM/MongoDB/Configuration.php">
921
<TypeDoesNotContainType>
1022
<code><![CDATA[$reflectionClass->implementsInterface(ClassMetadataFactoryInterface::class)]]></code>

0 commit comments

Comments
 (0)