Skip to content

Commit a903ddc

Browse files
committed
Address code review feedback
1 parent 062b5db commit a903ddc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Database.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use MongoDB\Builder\Pipeline;
2525
use MongoDB\Codec\Encoder;
2626
use MongoDB\Driver\ClientEncryption;
27-
use MongoDB\Driver\Cursor;
27+
use MongoDB\Driver\CursorInterface;
2828
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
2929
use MongoDB\Driver\Manager;
3030
use MongoDB\Driver\ReadConcern;
@@ -52,7 +52,6 @@
5252
use MongoDB\Operation\Watch;
5353
use stdClass;
5454
use Throwable;
55-
use Traversable;
5655

5756
use function is_array;
5857
use function strlen;
@@ -191,13 +190,12 @@ public function __toString(): string
191190
* @see Aggregate::__construct() for supported options
192191
* @param array $pipeline Aggregation pipeline
193192
* @param array $options Command options
194-
* @return Traversable
195193
* @throws UnexpectedValueException if the command response was malformed
196194
* @throws UnsupportedException if options are not supported by the selected server
197195
* @throws InvalidArgumentException for parameter/option parsing errors
198196
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
199197
*/
200-
public function aggregate(array $pipeline, array $options = []): Traversable
198+
public function aggregate(array $pipeline, array $options = []): CursorInterface&Iterator
201199
{
202200
if (is_builder_pipeline($pipeline)) {
203201
$pipeline = new Pipeline(...$pipeline);
@@ -250,7 +248,7 @@ public function aggregate(array $pipeline, array $options = []): Traversable
250248
* @throws InvalidArgumentException for parameter/option parsing errors
251249
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
252250
*/
253-
public function command(array|object $command, array $options = []): Cursor
251+
public function command(array|object $command, array $options = []): CursorInterface&Iterator
254252
{
255253
if (! isset($options['typeMap'])) {
256254
$options['typeMap'] = $this->typeMap;

0 commit comments

Comments
 (0)