diff --git a/phpstan.neon b/phpstan.neon index b4dfad5c..1c1d972a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 4 + level: 5 paths: - app - src diff --git a/src/ElasticSearch/Aggregation/Bucket.php b/src/ElasticSearch/Aggregation/Bucket.php index eb2027ff..0ab19670 100644 --- a/src/ElasticSearch/Aggregation/Bucket.php +++ b/src/ElasticSearch/Aggregation/Bucket.php @@ -4,28 +4,14 @@ namespace CultuurNet\UDB3\Search\ElasticSearch\Aggregation; -use InvalidArgumentException; - final class Bucket { private string $key; private int $count; - /** - * @param string $key - * @param int $count - */ - public function __construct($key, $count) + public function __construct(string $key, int $count) { - if (!is_string($key)) { - throw new InvalidArgumentException('Bucket key should be a string.'); - } - - if (!is_int($count)) { - throw new InvalidArgumentException('Bucket count should be an int.'); - } - $this->key = $key; $this->count = $count; } diff --git a/src/Http/Organizer/RequestParser/CompositeOrganizerRequestParser.php b/src/Http/Organizer/RequestParser/CompositeOrganizerRequestParser.php index 79d422f6..72fc594b 100644 --- a/src/Http/Organizer/RequestParser/CompositeOrganizerRequestParser.php +++ b/src/Http/Organizer/RequestParser/CompositeOrganizerRequestParser.php @@ -4,8 +4,8 @@ namespace CultuurNet\UDB3\Search\Http\Organizer\RequestParser; +use CultuurNet\UDB3\Search\Http\ApiRequestInterface; use CultuurNet\UDB3\Search\Organizer\OrganizerQueryBuilderInterface; -use Psr\Http\Message\ServerRequestInterface; final class CompositeOrganizerRequestParser implements OrganizerRequestParser { @@ -27,7 +27,7 @@ public function withParser(OrganizerRequestParser $parser): self } public function parse( - ServerRequestInterface $request, + ApiRequestInterface $request, OrganizerQueryBuilderInterface $organizerQueryBuilder ): OrganizerQueryBuilderInterface { foreach ($this->parsers as $parser) { diff --git a/src/PagedResultSet.php b/src/PagedResultSet.php index 730b02a4..aa2ec763 100644 --- a/src/PagedResultSet.php +++ b/src/PagedResultSet.php @@ -4,8 +4,8 @@ namespace CultuurNet\UDB3\Search; +use CultuurNet\UDB3\Search\Facet\FacetTreeInterface; use InvalidArgumentException; -use CultuurNet\UDB3\Search\Facet\FacetFilter; use CultuurNet\UDB3\Search\ReadModel\JsonDocument; final class PagedResultSet @@ -20,7 +20,7 @@ final class PagedResultSet private array $results; /** - * @var FacetFilter[] + * @var FacetTreeInterface[] */ private $facets; @@ -55,7 +55,7 @@ public function getResults(): array return $this->results; } - public function withFacets(FacetFilter ...$facetFilters): PagedResultSet + public function withFacets(FacetTreeInterface ...$facetFilters): PagedResultSet { $c = clone $this; $c->facets = $facetFilters; @@ -63,7 +63,7 @@ public function withFacets(FacetFilter ...$facetFilters): PagedResultSet } /** - * @return FacetFilter[] + * @return FacetTreeInterface[] */ public function getFacets(): array { diff --git a/tests/ElasticSearch/Aggregation/BucketTest.php b/tests/ElasticSearch/Aggregation/BucketTest.php index 97c9acba..f3259500 100644 --- a/tests/ElasticSearch/Aggregation/BucketTest.php +++ b/tests/ElasticSearch/Aggregation/BucketTest.php @@ -4,7 +4,6 @@ namespace CultuurNet\UDB3\Search\ElasticSearch\Aggregation; -use InvalidArgumentException; use PHPUnit\Framework\TestCase; final class BucketTest extends TestCase @@ -18,24 +17,4 @@ public function it_has_a_key_and_count(): void $this->assertEquals('key', $bucket->getKey()); $this->assertEquals(10, $bucket->getCount()); } - - /** - * @test - */ - public function it_checks_that_the_key_is_a_string(): void - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Bucket key should be a string.'); - new Bucket(true, 10); - } - - /** - * @test - */ - public function it_checks_that_the_count_is_an_int(): void - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Bucket count should be an int.'); - new Bucket('key', '10,000,0000'); - } }