New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic Attributes does not guess the type of a class-string #7171
Comments
Same problem here today |
Seems like the same issue was encountered using psalm : doctrine/orm#9681 A fix of the |
my temporary workaround in phpstan.neon to ignore this error parameters:
level: 8
ignoreErrors:
- '#repositoryClass(.*)expects class-string(.*)EntityRepository#' |
Fixed: phpstan/phpstan-src@361e064 |
Fix released in PHPStan 1.6.8: https://github.com/phpstan/phpstan/releases/tag/1.6.8 |
Thank you 🙏 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
I update the Doctrine Library to the newest version (2.12.2 at the moment of writing) that incorporates psalm generics for the
Entity
attribute, but this cause that PHPStan report many errors relative with the parameter "repositoryClass", saying that my repositories (that extends the ServiceEntityRepository) was not allowed because it not represents a class-string for EntityRepository. Because ServiceEntityRepository extends from EntityRepository, it should be covariant.It seems that the error is unique for the generic attributes, because I testes with generic classes and PHPStan is happy with the same type constraints.
Code snippet that reproduces the problem
https://phpstan.org/r/15c3b24f-ad7c-47b0-a1d2-da219cdd5edb
Expected output
It should not throw error
Did PHPStan help you today? Did it make you happy in any way?
I am not good with the words, but PHPStan help me catch many errors and save me tens of hours of painfull debugging. Keep going with that fantastic work!
The text was updated successfully, but these errors were encountered: