2929use Doctrine \ODM \MongoDB \Utility \CollectionHelper ;
3030use Doctrine \Persistence \Mapping \MappingException ;
3131use InvalidArgumentException ;
32- use Iterator as SplIterator ;
3332use MongoDB \BSON \ObjectId ;
3433use MongoDB \Collection ;
3534use MongoDB \Driver \CursorInterface ;
@@ -333,8 +332,8 @@ private function executeUpsert(object $document, array $options): void
333332 $ data = ['$set ' => ['_id ' => $ criteria ['_id ' ]]];
334333 }
335334
335+ assert ($ this ->collection instanceof Collection);
336336 try {
337- assert ($ this ->collection instanceof Collection);
338337 $ this ->collection ->updateOne ($ criteria , $ data , $ options );
339338
340339 return ;
@@ -344,7 +343,6 @@ private function executeUpsert(object $document, array $options): void
344343 }
345344 }
346345
347- assert ($ this ->collection instanceof Collection);
348346 $ this ->collection ->updateOne ($ criteria , ['$set ' => new stdClass ()], $ options );
349347 }
350348
@@ -544,8 +542,6 @@ public function loadAll(array $criteria = [], ?array $sort = null, ?int $limit =
544542 assert ($ this ->collection instanceof Collection);
545543 $ baseCursor = $ this ->collection ->find ($ criteria , $ options );
546544
547- assert ($ baseCursor instanceof CursorInterface && $ baseCursor instanceof SplIterator);
548-
549545 return $ this ->wrapCursor ($ baseCursor );
550546 }
551547
@@ -592,7 +588,7 @@ private function getShardKeyQuery(object $document): array
592588 /**
593589 * Wraps the supplied base cursor in the corresponding ODM class.
594590 */
595- private function wrapCursor (SplIterator & CursorInterface $ baseCursor ): Iterator
591+ private function wrapCursor (CursorInterface $ baseCursor ): Iterator
596592 {
597593 return new CachingIterator (new HydratingIterator ($ baseCursor , $ this ->dm ->getUnitOfWork (), $ this ->class ));
598594 }
0 commit comments