runtothefather/doctrine-psalm-plugin

仓库解析器,用于向psalm展示如何解析getRepository方法

0.6 2020-02-19 08:46 UTC

This package is auto-updated.

Last update: 2024-09-19 19:02:50 UTC


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>