runtothefather/doctrine-psalm-plugin

Repository resolver to show psalm how to resolve getRepository method

Installs: 6 261

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 2

Forks: 2

Open Issues: 0

Type:psalm-plugin

pkg:composer/runtothefather/doctrine-psalm-plugin

0.6 2020-02-19 08:46 UTC

This package is auto-updated.

Last update: 2025-09-19 21:05:01 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>