Skip to content

Commit ae64a40

Browse files
committed
cs(state): phpdoc rather than asserting
Continues the work at api-platform#7079 and before at api-platform#6865 See api-platform#6971.
1 parent 6a8cb3a commit ae64a40

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/Doctrine/Odm/Filter/ExactFilter.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, ?Opera
2727
return;
2828
}
2929

30-
\assert($parameter instanceof Parameter);
31-
3230
$values = (array) $parameter->getValue();
3331

34-
//TODO: handle nested properties
32+
// TODO: handle nested properties
3533
$property = $parameter->getProperty();
3634

3735
$aggregationBuilder

src/Doctrine/Odm/Filter/FilterInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use ApiPlatform\Metadata\FilterInterface as BaseFilterInterface;
1717
use ApiPlatform\Metadata\Operation;
18+
use ApiPlatform\Metadata\Parameter;
1819
use Doctrine\ODM\MongoDB\Aggregation\Builder;
1920

2021
/**
@@ -26,6 +27,8 @@ interface FilterInterface extends BaseFilterInterface
2627
{
2728
/**
2829
* Applies the filter.
30+
*
31+
* @param array{'parameter'?: Parameter, ...} $context
2932
*/
3033
public function apply(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void;
3134
}

src/Doctrine/Odm/Filter/IriFilter.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, ?Opera
2929
return;
3030
}
3131

32-
\assert($parameter instanceof Parameter);
33-
3432
$value = $parameter->getValue();
3533
if (!\is_array($value)) {
3634
$value = [$value];
3735
}
3836

39-
//TODO: handle nested properties
37+
// TODO: handle nested properties
4038
$property = $parameter->getProperty();
4139

4240
$aggregationBuilder

src/Doctrine/Odm/Filter/PartialSearchFilter.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, ?Opera
2828
return;
2929
}
3030

31-
\assert($parameter instanceof Parameter);
32-
3331
$value = $parameter->getValue();
3432
if (!\is_string($value) || '' === $value) {
3533
return;
3634
}
3735

38-
//TODO: handle nested properties
36+
// TODO: handle nested properties
3937
$property = $parameter->getProperty();
4038
$escapedValue = preg_quote($value, '/');
4139

src/Doctrine/Orm/Filter/FilterInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
1717
use ApiPlatform\Metadata\FilterInterface as BaseFilterInterface;
1818
use ApiPlatform\Metadata\Operation;
19+
use ApiPlatform\Metadata\Parameter;
1920
use Doctrine\ORM\QueryBuilder;
2021

2122
/**
@@ -27,6 +28,8 @@ interface FilterInterface extends BaseFilterInterface
2728
{
2829
/**
2930
* Applies the filter.
31+
*
32+
* @param array{'parameter'?: Parameter} $context
3033
*/
3134
public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void;
3235
}

0 commit comments

Comments
 (0)