-
-
Notifications
You must be signed in to change notification settings - Fork 921
Inconsisten analysis results #12972
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
Comments
Yeah, this usually happens when symlinks are involved, or when a file with exactly the same contents is discovered by PHPStan outside of analysed paths (although I fixed some bugs related to that). |
In my case the root problem is, that a custom autoloader builds a "nearly correct" path to the file (which has wrong casing), but the macos filesystem still says even though in the filesystem the path actually is therefore the "wrong" path is |
The joys of case-insensitive filesystems 😊 Probably not much we can do about that. |
I hate our home grown custom autoloader - especially in hybrid with a composer autoloader, which would do a better job when beeing alone. thanks for the emotional support while crying thru all this shit ;) |
Would it be worth to detect a case-insensitive filesystem and compare paths in a insensitive way? |
I'm not even sure why an autoloader and a reflection filename have say in this. Would be interesting to see this reproduced here in E2E suite running on windows-latest. |
see in the last line of the output, that
regression test and fix in phpstan/phpstan-src#3988 |
Bug report
I am currently debugging a strange problem.
I have a file, when analyzed with a path command like
vendor/bin/phpstan analyze lib/cms/ -c app/portal/phpstan.neon.dist --debug
reports error, likerunning analysis over the very same file with a different command, e.g.
vendor/bin/phpstan analyze lib/cms/service/ -c app/portal/phpstan.neon.dist --debug
or
vendor/bin/phpstan analyze lib/cms/service/CmsImageService.php -c app/portal/phpstan.neon.dist --debug
yields 0 errors.
I have debugged the situation to a point, in which I can see that the different error results occur, because the Analyzer gets a different AST node-tree.
in the error case, the Analyzer gets a AST in which the ClassMethod nodes contain a empty array of statements (even though the file beeing analyzed does have code in its methods)
when the very same file is analyzed with one of the working commands the AST looks like this:
I am not yet able to create a small reproducer and atm I only see this problem in a single project
Code snippet that reproduces the problem
n/a
Expected output
consistent behaviour
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: