29
29
use Doctrine \ODM \MongoDB \Utility \CollectionHelper ;
30
30
use Doctrine \Persistence \Mapping \MappingException ;
31
31
use InvalidArgumentException ;
32
- use Iterator as SplIterator ;
33
32
use MongoDB \BSON \ObjectId ;
34
33
use MongoDB \Collection ;
35
34
use MongoDB \Driver \CursorInterface ;
@@ -333,8 +332,8 @@ private function executeUpsert(object $document, array $options): void
333
332
$ data = ['$set ' => ['_id ' => $ criteria ['_id ' ]]];
334
333
}
335
334
335
+ assert ($ this ->collection instanceof Collection);
336
336
try {
337
- assert ($ this ->collection instanceof Collection);
338
337
$ this ->collection ->updateOne ($ criteria , $ data , $ options );
339
338
340
339
return ;
@@ -344,7 +343,6 @@ private function executeUpsert(object $document, array $options): void
344
343
}
345
344
}
346
345
347
- assert ($ this ->collection instanceof Collection);
348
346
$ this ->collection ->updateOne ($ criteria , ['$set ' => new stdClass ()], $ options );
349
347
}
350
348
@@ -544,8 +542,6 @@ public function loadAll(array $criteria = [], ?array $sort = null, ?int $limit =
544
542
assert ($ this ->collection instanceof Collection);
545
543
$ baseCursor = $ this ->collection ->find ($ criteria , $ options );
546
544
547
- assert ($ baseCursor instanceof CursorInterface && $ baseCursor instanceof SplIterator);
548
-
549
545
return $ this ->wrapCursor ($ baseCursor );
550
546
}
551
547
@@ -592,7 +588,7 @@ private function getShardKeyQuery(object $document): array
592
588
/**
593
589
* Wraps the supplied base cursor in the corresponding ODM class.
594
590
*/
595
- private function wrapCursor (SplIterator & CursorInterface $ baseCursor ): Iterator
591
+ private function wrapCursor (CursorInterface $ baseCursor ): Iterator
596
592
{
597
593
return new CachingIterator (new HydratingIterator ($ baseCursor , $ this ->dm ->getUnitOfWork (), $ this ->class ));
598
594
}
0 commit comments