Open JanTvrdik opened 2 months ago
The code to report that is there in FunctionDefinitionCheck, so it's gonna definitely be something tricky...
I managed to make some progress on this but I am not sure if this is the correct way. PHPParser
stores the original name in the attributes, so it is pretty easy to use it in case it exists. Also, PHPParser
has a replaceNodes
options which if you disable it also fixes the issue. The problem with this option is that it breaks a lot of tests if you disable it and, of course, you might not need it disabled all the time.
Source: https://github.com/nikic/PHP-Parser/blob/master/doc/component/Name_resolution.markdown
Bug report
class.nameCase error is not reported when the correct case is used in
use
statement and wrong case is used in return typeCode snippet that reproduces the problem
https://phpstan.org/r/13cacbc4-8d7a-4e8f-8f0f-79afa8aa55af
Expected output
Class DateTimeImmutable referenced with incorrect case: dateTimeImmutable.
Did PHPStan help you today? Did it make you happy in any way?
No response