Get stubs from StubFilesProvider#1355
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-devstill does not validate the stubs loaded from the extension.AnalyseApplicationwas the only place I found that callsStubValidator::validateSo I thought here the stub files should also be obtained fromStubFilesProvider::getStubFiles