From faf0ea1d45067d793549901207cfae52f760e93a Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 16 Feb 2024 22:46:27 +0100 Subject: [PATCH] Fix PHPStan issues --- src/Repository/EntitySpecificationRepository.php | 2 +- src/Repository/EntitySpecificationRepositoryTrait.php | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Repository/EntitySpecificationRepository.php b/src/Repository/EntitySpecificationRepository.php index 9bde7d10..7cf15408 100644 --- a/src/Repository/EntitySpecificationRepository.php +++ b/src/Repository/EntitySpecificationRepository.php @@ -19,7 +19,7 @@ /** * This class allows you to use a Specification to query entities. * - * @template T + * @template T of object * @phpstan-extends EntityRepository */ class EntitySpecificationRepository extends EntityRepository implements EntitySpecificationRepositoryInterface diff --git a/src/Repository/EntitySpecificationRepositoryTrait.php b/src/Repository/EntitySpecificationRepositoryTrait.php index 3f7d15b6..25a7b5d4 100644 --- a/src/Repository/EntitySpecificationRepositoryTrait.php +++ b/src/Repository/EntitySpecificationRepositoryTrait.php @@ -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(); } /**