Skip to content

Commit

Permalink
get expression returns array-non-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Mar 31, 2023
1 parent 00c4324 commit d843c1a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

use function array_map;
use function array_unshift;
use function assert;
use function count;
use function func_get_arg;
use function func_num_args;
use function gettype;
Expand Down Expand Up @@ -288,8 +286,6 @@ public function getPipeline(/* bool $applyFilters = true */): array
));
}

assert(count($this->stages) > 0);

$pipeline = array_map(
static fn (Stage $stage) => $stage->getExpression(),
$this->stages,
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Aggregation/Stage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(Builder $builder)
/**
* Assembles the aggregation stage
*
* @return array<non-empty-string, mixed>
* @return non-empty-array<non-empty-string, mixed>
*/
abstract public function getExpression(): array;

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function from(string $from): static

public function getExpression(): array
{
$restrictSearchWithMatch = $this->restrictSearchWithMatch->getExpression() ?: (object) [];
$restrictSearchWithMatch = $this->restrictSearchWithMatch->getExpression();

$graphLookup = [
'from' => $this->from,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function returnStoredSource(bool $returnStoredSource): Search
return $this->search->returnStoredSource($returnStoredSource);
}

/** @return array<non-empty-string, object> */
/** @return non-empty-array<non-empty-string, object> */
final public function getExpression(): array
{
return [$this->getOperatorName() => $this->getOperatorParams()];
Expand Down

0 comments on commit d843c1a

Please sign in to comment.