From 64ec92e8666f910c0555eb9409900df805204611 Mon Sep 17 00:00:00 2001 From: soyuka Date: Wed, 6 Sep 2023 09:51:49 +0200 Subject: [PATCH] Aggregation uses CursorInterface instead of Cursor --- lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php b/lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php index b1d2a6955e..0c6e7aa130 100644 --- a/lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php +++ b/lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php @@ -12,10 +12,9 @@ use Doctrine\ODM\MongoDB\Mapping\ClassMetadata; use IteratorAggregate; use MongoDB\Collection; -use MongoDB\Driver\Cursor; +use MongoDB\Driver\CursorInterface; use function array_merge; -use function assert; /** @psalm-import-type PipelineExpression from Builder */ final class Aggregation implements IteratorAggregate @@ -35,12 +34,11 @@ public function getIterator(): Iterator $options = array_merge($this->options, ['cursor' => true]); $cursor = $this->collection->aggregate($this->pipeline, $options); - assert($cursor instanceof Cursor); return $this->prepareIterator($cursor); } - private function prepareIterator(Cursor $cursor): Iterator + private function prepareIterator(CursorInterface&Iterator $cursor): Iterator { if ($this->classMetadata) { $cursor = new HydratingIterator($cursor, $this->dm->getUnitOfWork(), $this->classMetadata);