runtothefather/doctrine-psalm-plugin

Repository resolver to show psalm how to resolve getRepository method

0.6 2020-02-19 08:46 UTC

This package is auto-updated.

Last update: 2020-10-19 10:18:04 UTC


README

By default psalm doesn't recognize return type for cases like this

$object->getRepository(Entity::class)

where $object can be instance of

Doctrine\Common\Persistence\ObjectManager
Symfony\Bridge\Doctrine\RegistryInterface
Doctrine\Common\Persistence\AbstractManagerRegistry
Doctrine\Common\Persistence\ManagerRegistry

repository class from @ORM\Entity(repositoryClass="Doctrine\Common\Persistence\ObjectRepository") will be returned

Usage

Add into your psalm.xml file into <plugins> section line

<plugin filename="vendor/runtothefather/doctrine-psalm-plugin/src/ReturnTypeProvider/GetRepositoryReturnTypeProvider.php"></plugin>