- Notifications
You must be signed in to change notification settings - Fork 111
Open
Description
With this entity:
#[Entity] class Person { #[Id] #[Column(type: "integer")] public int $id; public static function getQb(EntityManager $em): QueryBuilder { return $em->createQueryBuilder() ->select('p') ->from(self::class, 'p'); } }
And this code:
class Test { public static function test(EntityManager $em): void { Person::getQb($em)->getQuery()->getResult(); } }
I get the following error:
-- -------------------------------------------------------------------------------------------------------------------- Error -- -------------------------------------------------------------------------------------------------------------------- Internal error: Internal error: Class "App\Test" is not a valid entity or mapped super class. while analysing file C:\Projekte\TestProjects\PhpstanDoctrine\src\Test.php Run PHPStan with -v option and post the stack trace to: https://github.com/phpstan/phpstan/issues/new?template=Bug_report.yaml Child process error (exit code 1): -- --------------------------------------------------------------------------------------------------------------------
If I replace self::class
with Person::class
, it works as expected. It seems that self
is being understood to be Test
, when in fact it refers to Person
. I can provide a fuller reproduction example if desired. This seems to have gone broken in a recent release.
Metadata
Metadata
Assignees
Labels
No labels