You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[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.
The text was updated successfully, but these errors were encountered:
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'Doctrine\ORM\Query<null, QueryResult\Entities\One>'
+'Doctrine\ORM\Query<mixed, mixed>'
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'list<QueryResult\Entities\One>'
+'mixed'
With this entity:
And this code:
I get the following error:
If I replace
self::class
withPerson::class
, it works as expected. It seems thatself
is being understood to beTest
, when in fact it refers toPerson
. I can provide a fuller reproduction example if desired. This seems to have gone broken in a recent release.The text was updated successfully, but these errors were encountered: