1 | <?php |
||
27 | class RepositoryFactory implements RepositoryFactoryInterface |
||
28 | { |
||
29 | /** |
||
30 | * Gets the repository for an entity class. |
||
31 | * |
||
32 | * @param EntityManagerInterface $entityManager the EntityManager instance |
||
33 | * @param string $entityName the name of the entity |
||
34 | * |
||
35 | * @return EntityRepository |
||
36 | * |
||
37 | * @phpstan-template T |
||
38 | * @phpstan-param class-string<T> $entityName |
||
39 | * @phpstan-return EntityRepository<T> |
||
40 | */ |
||
41 | public function getRepository(EntityManagerInterface $entityManager, $entityName): EntityRepository |
||
45 | } |
||
46 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.