runtothefather / doctrine-psalm-plugin
仓库解析器,用于向psalm展示如何解析getRepository方法
0.6
2020-02-19 08:46 UTC
Requires
- doctrine/orm: ^2.6
- symfony/doctrine-bridge: ^4.3
- vimeo/psalm: ^3.8
Requires (Dev)
- phpunit/phpunit: ^8.5
README
默认情况下,psalm无法识别如下情况下的返回类型
$object->getRepository(Entity::class)
其中 $object 可以是以下类型之一
Doctrine\Common\Persistence\ObjectManager
Symfony\Bridge\Doctrine\RegistryInterface
Doctrine\Common\Persistence\AbstractManagerRegistry
Doctrine\Common\Persistence\ManagerRegistry
从 @ORM\Entity(repositoryClass="Doctrine\Common\Persistence\ObjectRepository")
注解中指定的 repository 类将被返回
使用方法
将以下内容添加到您的 psalm.xml 文件的 <plugins>
部分行
<plugin filename="vendor/runtothefather/doctrine-psalm-plugin/src/ReturnTypeProvider/GetRepositoryReturnTypeProvider.php"></plugin>