phpstan-doctrine
phpstan-doctrine copied to clipboard
`getManagerForClass` is not correctly resolved by Phpstan-doctrine
The following code
class Foo
{
private EntityManagerInterface $entityManager;
public function __construct(
ManagerRegistry $managerRegistry,
) {
$this->entityManager = $managerRegistry->getManagerForClass(Bar::class);
}
return the errors
Property Foo::$entityManager (Doctrine\ORM\EntityManagerInterface) does not accept Doctrine\Persistence\ObjectManager|null.
Since EntityManager::getRepository
give the correct Repository class
Since 1.2.0, this extension resolve entity metadata without objectManagerLoader. I was wondering if the same could be done for managerRegistry.
Do you think this can be done by this extension @ondrejmirtes ? Any recommendation how-to ? I can try