-
Notifications
You must be signed in to change notification settings - Fork 529
Get stubs from StubFilesProvider #1355
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
Conversation
The reason for the original code was that PHPStan does not analyse and report bugs from 3rd party stubs. So it used |
What are 3rd party stubs? |
Aah, you mean for example an application requires a PHPStan extension that has Yeah, that's a tough issue I guess. |
Currently it's not perfect either, some users have their project configuration consisting of their own multiple neon files, like https://github.com/pmmp/PocketMine-MP/blob/39b8daeeec3fd2ad9a8593bb15edca65349948bd/phpstan.neon.dist#L1-L11. So the question is - how to recognize project stub files from 3rd party ones? Just exclude those from |
Ok, I tried something. But not sure how to test it. I can write a unit test for the |
A few things to complicate your life:
Otherwise I think it should be fine - please test this in practice in your project if it works as expected. You can grab the PHAR file artifact of this PR in Compile PHAR workflow (rename it to phpstan.phar and copy it to vendor/phpstan/phpstan) https://github.com/phpstan/phpstan-src/actions/runs/2401474675 Don't worry about phpstan-doctrine failures, I expected them 😊 |
BTW the vendor-dir approach could be fixed in more places around the codebase where "vendor" is currently hardcoded 😊 |
Updated to use the new |
Awesome, thank you! |
Followup to d3589dc
Currently
1.7.x-dev
still does not validate the stubs loaded from the extension.AnalyseApplication
was the only place I found that callsStubValidator::validate
So I thought here the stub files should also be obtained fromStubFilesProvider::getStubFiles