From 9d12594ab661f917ca33b34bb401f252013bb237 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Mon, 3 Apr 2023 15:15:14 -0300 Subject: [PATCH] Parameter 4 in `Query::__construct()` can not use an empty array as default value --- lib/Doctrine/ODM/MongoDB/Query/Query.php | 4 ++-- psalm-baseline.xml | 5 ----- tests/Doctrine/ODM/MongoDB/Tests/QueryTest.php | 2 ++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/ODM/MongoDB/Query/Query.php b/lib/Doctrine/ODM/MongoDB/Query/Query.php index 86529e74c..267fb1134 100644 --- a/lib/Doctrine/ODM/MongoDB/Query/Query.php +++ b/lib/Doctrine/ODM/MongoDB/Query/Query.php @@ -57,7 +57,7 @@ * skip?: int, * snapshot?: bool, * sort?: array, - * type?: Query::TYPE_*, + * type: Query::TYPE_*, * upsert?: bool, * } * @psalm-import-type Hints from UnitOfWork @@ -136,7 +136,7 @@ final class Query implements IteratorAggregate * @param array $options * @param array $primers */ - public function __construct(DocumentManager $dm, ClassMetadata $class, Collection $collection, array $query = [], array $options = [], bool $hydrate = true, bool $refresh = false, array $primers = [], bool $readOnly = false, bool $rewindable = true) + public function __construct(DocumentManager $dm, ClassMetadata $class, Collection $collection, array $query, array $options = [], bool $hydrate = true, bool $refresh = false, array $primers = [], bool $readOnly = false, bool $rewindable = true) { $primers = array_filter($primers); diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 439b6dee2..604a35c04 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -514,11 +514,6 @@ 1 - - - -1]]]> - - new IndexInfoIteratorIterator(new ArrayIterator($indexes)) diff --git a/tests/Doctrine/ODM/MongoDB/Tests/QueryTest.php b/tests/Doctrine/ODM/MongoDB/Tests/QueryTest.php index a7823c8ee..f809c8a7a 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/QueryTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/QueryTest.php @@ -418,6 +418,8 @@ public function testReadOnly(): void public function testConstructorShouldThrowExceptionForInvalidType(): void { $this->expectException(InvalidArgumentException::class); + + /** @psalm-suppress InvalidArgument */ new Query($this->dm, new ClassMetadata(User::class), $this->getMockCollection(), ['type' => -1], []); }