diff --git a/Repository/ContainerRepositoryFactory.php b/Repository/ContainerRepositoryFactory.php index 1907c5384..49b172d84 100644 --- a/Repository/ContainerRepositoryFactory.php +++ b/Repository/ContainerRepositoryFactory.php @@ -20,7 +20,7 @@ */ final class ContainerRepositoryFactory implements RepositoryFactory { - /** @var ObjectRepository[] */ + /** @var array */ private $managedRepositories = []; /** @var ContainerInterface */ @@ -68,6 +68,13 @@ public function getRepository(EntityManagerInterface $entityManager, $entityName return $this->getOrCreateRepository($entityManager, $metadata); } + /** + * @param ClassMetadata $metadata + * + * @return ObjectRepository + * + * @template TEntity of object + */ private function getOrCreateRepository( EntityManagerInterface $entityManager, ClassMetadata $metadata @@ -79,6 +86,7 @@ private function getOrCreateRepository( $repositoryClassName = $metadata->customRepositoryClassName ?: $entityManager->getConfiguration()->getDefaultRepositoryClassName(); + /** @psalm-var ObjectRepository */ return $this->managedRepositories[$repositoryHash] = new $repositoryClassName($entityManager, $metadata); } } diff --git a/Repository/ServiceEntityRepository.php b/Repository/ServiceEntityRepository.php index 877d447f1..dd274065f 100644 --- a/Repository/ServiceEntityRepository.php +++ b/Repository/ServiceEntityRepository.php @@ -22,7 +22,7 @@ * } * } * - * @template T + * @template T of object * @template-extends EntityRepository */ class ServiceEntityRepository extends EntityRepository implements ServiceEntityRepositoryInterface diff --git a/psalm.xml.dist b/psalm.xml.dist index dc843675e..a0cb0fb23 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -33,18 +33,18 @@ - - - - - - + + + + + +