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
PHPStan confuses same-name template types defined in different classes #4557
Comments
This bug report is missing a link to reproduction on phpstan.org. It will most likely be closed after manual review. |
You're running a really old version of PHPStan, 0.12.57 was released almost 3 months ago. I'm pretty sure this will work with the latest 0.12.77 release. That's why you can't reproduce it. |
Sorry for not mentioning it explicitly. The actual output in the description is taken from the local environment where I had all dependencies updated:
|
Playground reproduction: https://phpstan.org/r/b39c6660-2a19-4c41-a54e-b6f4d0c63056 |
Fixed: phpstan/phpstan-src@527269a |
Thank you, @ondrejmirtes! |
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
If a template type with the same name is used in two classes, one of which calls a method of the other, PHPStan confuses the type constraint that should be applied to the argument used in a call.
The issue is currently reproducible on doctrine/dbal#4501 but I cannot reproduce it in the playground.
Code snippet that reproduces the problem
Expected output
No issue.
Actual output
If I rename the template type
T
to something else (e.g.Z
), the problem disappears.Even if the problem is in the code, the error message is misleading:
The text was updated successfully, but these errors were encountered: