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
4.17.0 scans vendor folder even when it is in ignored files #7289
Comments
Hey @SharkMachine, can you reproduce the issue on https://psalm.dev ? |
unfortunately, this is expected behavior. Psalm will not analyze the vendor dir if you ignored it. However, it still needs to know the types from the dependencies you use. For example if you have $var = Dependency::getSpecialResult();
assert(is_int($var)); Psalm needs to be able to check if you fetched an int or not from the dependency. For that, it performs a quick scan of the phpdoc and signatures of all the files you actually use as a dependency. If it can't read those, Psalm is unable to work properly (In the example above, what would you expect to have as a result of Psalm having no idea what's in the result?). So when that happens, it throws an InvalidDocblock, even in ignored files. This is not a new behavior either. What changed is that we tweaked our own dependencies in the last release and it must have changed your own resolved dependencies by Composer and retrieved (newer and) flawed versions. I pushed a first PR for the second error, it seems to be a typo. However, the first one is more tricky, it uses a relatively new syntax from phpstan |
For me it looks like something else has changed as well as 4.17.0 tells me it's analyzing 1779 files and 4.16.1 tells me that no files were analyzed. Analyzing also takes over 30 seconds longer with 4.17.0 than with 4.16.1, and it takes less than a second with 4.16.1. This is the case when the only dependency is Psalm itself as a dev dependency. |
@SharkMachine do those numbers come from a |
@weirdan Yes, here's the output from both runs: 4.16.1
4.17.0
|
Mind running that without |
Thanks. That did the trick and 4.17 doesn't analyze vendor folder any more. |
My bad, my first explanation was wrong then. At least we found two errors in third packages :) |
A little explanation is warranted here. When you pass a path argument, Psalm is supposed to ignore any file filters you may have in your config file. Historically we had a bug that made Psalm ignore #7210 dropped the buggy part, so the bug was accidentally fixed (thanks @vstm). |
How to reproduce:
composer.json
andpsalm.xml
to an empty foldercomposer.json
psalm.xml
composer update
and./vendor/bin/psalm ./
Result with 4.17.0
Result with 4.16.1
The text was updated successfully, but these errors were encountered: