Skip to content

Commit

Permalink
Fix PHPStan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Feb 16, 2024
1 parent 207abd0 commit 4456bbe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Repository/EntitySpecificationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* This class allows you to use a Specification to query entities.
*
* @template T
* @template T of object
* @phpstan-extends EntityRepository<T>
*/
class EntitySpecificationRepository extends EntityRepository implements EntitySpecificationRepositoryInterface
Expand Down
9 changes: 1 addition & 8 deletions src/Repository/EntitySpecificationRepositoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,7 @@ public function getQueryBuilder($specification, ?string $alias = null): QueryBui
public function iterate($specification, ?ResultModifier $modifier = null): \Traversable
{
$query = $this->getQuery($specification, $modifier);

if (method_exists($query, 'toIterable')) {
yield from $query->toIterable();
} else {
foreach ($query->iterate() as $key => $row) {
yield $key => current($row);
}
}
yield from $query->toIterable();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/RepositoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RepositoryFactory implements RepositoryFactoryInterface
*
* @return EntityRepository
*
* @phpstan-template T
* @phpstan-template T of object
* @phpstan-param class-string<T> $entityName
* @phpstan-return EntityRepository<T>
*/
Expand Down

0 comments on commit 4456bbe

Please sign in to comment.