Skip to content

Commit

Permalink
Update declared return types for query and aggregation builders
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Nov 28, 2024
1 parent 383b66d commit ce8f0f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\ODM\MongoDB\Aggregation\Stage\Sort;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Iterator\IterableResult;
use Doctrine\ODM\MongoDB\Iterator\Iterator;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Persisters\DocumentPersister;
Expand Down Expand Up @@ -246,8 +247,10 @@ public function geoNear($x, $y = null): Stage\GeoNear
* Returns an aggregation object for the current pipeline
*
* @param array<string, mixed> $options
*
* @return Aggregation
*/
public function getAggregation(array $options = []): Aggregation
public function getAggregation(array $options = []): IterableResult
{
$class = $this->hydrationClass ? $this->dm->getClassMetadata($this->hydrationClass) : null;

Expand Down
5 changes: 4 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use BadMethodCallException;
use Doctrine\ODM\MongoDB\Aggregation\Stage\Sort;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Iterator\IterableResult;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use GeoJson\Geometry\Geometry;
use GeoJson\Geometry\Point;
Expand Down Expand Up @@ -659,8 +660,10 @@ public function getNewObj(): array
* Gets the Query executable.
*
* @param array<string, mixed> $options
*
* @return Query
*/
public function getQuery(array $options = []): Query
public function getQuery(array $options = []): IterableResult
{
$documentPersister = $this->dm->getUnitOfWork()->getDocumentPersister($this->class->name);

Expand Down

0 comments on commit ce8f0f3

Please sign in to comment.