Skip to content

Commit

Permalink
Merge branch 'dependabot/composer/phpstan/phpstan-0.12.90'
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Jul 2, 2021
2 parents a0b9ae6 + 5d3b7e1 commit 82d0cfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"marc-mabe/php-enum": "~3.0",
"mockery/mockery": "~1.2",
"phpstan/extension-installer": "1.1.0",
"phpstan/phpstan": "0.12.88",
"phpstan/phpstan": "0.12.90",
"phpstan/phpstan-deprecation-rules": "0.12.6",
"phpstan/phpstan-nette": "0.12.17",
"phpstan/phpstan-mockery": "0.12.14",
Expand Down
5 changes: 3 additions & 2 deletions src/Collection/ArrayCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ArrayCollection implements ICollection
{
/**
* @var callable[]
* @phpstan-var list<callable(\Traversable $entities): void>
* @phpstan-var list<callable(\Traversable<E> $entities): void>
*/
public $onEntityFetch = [];

Expand Down Expand Up @@ -212,9 +212,11 @@ public function getIterator(): Iterator
$collection = clone $this;
$collection->relationshipMapper = null;
$collection->relationshipParent = null;
/** @var Iterator<E> $entityIterator */
$entityIterator = $this->relationshipMapper->getIterator($this->relationshipParent, $collection);
} else {
$this->processData();
/** @var Iterator<E> $entityIterator */
$entityIterator = new EntityIterator($this->data);
}

Expand All @@ -226,7 +228,6 @@ public function getIterator(): Iterator
$this->entityFetchEventTriggered = true;
}

/** @phpstan-var Iterator<E> */
return $entityIterator;
}

Expand Down
5 changes: 3 additions & 2 deletions src/Collection/DbalCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DbalCollection implements ICollection
{
/**
* @var callable[]
* @phpstan-var list<callable(\Traversable $entities): void>
* @phpstan-var list<callable(\Traversable<E> $entities): void>
*/
public $onEntityFetch = [];

Expand Down Expand Up @@ -216,13 +216,15 @@ public function __call(string $name, array $args)
public function getIterator(): Iterator
{
if ($this->relationshipParent !== null && $this->relationshipMapper !== null) {
/** @phpstan-var Iterator<E> */
$entityIterator = $this->relationshipMapper->getIterator($this->relationshipParent, $this);
} else {
if ($this->result === null) {
$this->execute();
}

assert(is_array($this->result));
/** @phpstan-var Iterator<E> */
$entityIterator = new EntityIterator($this->result);
}

Expand All @@ -234,7 +236,6 @@ public function getIterator(): Iterator
$this->entityFetchEventTriggered = true;
}

/** @phpstan-var Iterator<E> */
return $entityIterator;
}

Expand Down

0 comments on commit 82d0cfc

Please sign in to comment.