|
24 | 24 | use MongoDB\Builder\Pipeline; |
25 | 25 | use MongoDB\Codec\Encoder; |
26 | 26 | use MongoDB\Driver\ClientEncryption; |
27 | | -use MongoDB\Driver\Cursor; |
| 27 | +use MongoDB\Driver\CursorInterface; |
28 | 28 | use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; |
29 | 29 | use MongoDB\Driver\Manager; |
30 | 30 | use MongoDB\Driver\ReadConcern; |
|
52 | 52 | use MongoDB\Operation\Watch; |
53 | 53 | use stdClass; |
54 | 54 | use Throwable; |
55 | | -use Traversable; |
56 | 55 |
|
57 | 56 | use function is_array; |
58 | 57 | use function strlen; |
@@ -191,13 +190,12 @@ public function __toString(): string |
191 | 190 | * @see Aggregate::__construct() for supported options |
192 | 191 | * @param array $pipeline Aggregation pipeline |
193 | 192 | * @param array $options Command options |
194 | | - * @return Traversable |
195 | 193 | * @throws UnexpectedValueException if the command response was malformed |
196 | 194 | * @throws UnsupportedException if options are not supported by the selected server |
197 | 195 | * @throws InvalidArgumentException for parameter/option parsing errors |
198 | 196 | * @throws DriverRuntimeException for other driver errors (e.g. connection errors) |
199 | 197 | */ |
200 | | - public function aggregate(array $pipeline, array $options = []): Traversable |
| 198 | + public function aggregate(array $pipeline, array $options = []): CursorInterface&Iterator |
201 | 199 | { |
202 | 200 | if (is_builder_pipeline($pipeline)) { |
203 | 201 | $pipeline = new Pipeline(...$pipeline); |
@@ -250,7 +248,7 @@ public function aggregate(array $pipeline, array $options = []): Traversable |
250 | 248 | * @throws InvalidArgumentException for parameter/option parsing errors |
251 | 249 | * @throws DriverRuntimeException for other driver errors (e.g. connection errors) |
252 | 250 | */ |
253 | | - public function command(array|object $command, array $options = []): Cursor |
| 251 | + public function command(array|object $command, array $options = []): CursorInterface&Iterator |
254 | 252 | { |
255 | 253 | if (! isset($options['typeMap'])) { |
256 | 254 | $options['typeMap'] = $this->typeMap; |
|
0 commit comments