-
Not sure how to handle this but I've got a library I'm trying to support so I've got a matrix of PHP versions that I test it against. Everything from PHP 7.3 -> 8.1 currently. When I run psalm it detects the language as the minimum language I specify in composer.json and until recently that's worked great. Unfortunately some libraries it depend on have started updating to use 8.X specific features. This doesn't break the library because the interfaces are the same and they're tagged to the correct supported versions so the 7.x matrix gets the older version of the library and the 8.x matrix gets the newer version like one would expect. The problem comes from the fact that psalm detects the version as the minimum version and, despite being told to ignore the vendor directory, scans the used files and triggers parse errors on new features like match in the vendor files. So I guess that gets to my question which is twofold.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You absolutely can tell Psalm what version it must use for analysis: https://psalm.dev/docs/running_psalm/configuration/#phpversion Psalm is not currently completely aware of what is vendor code and what is project code in some particular (but common cases), it would be a pretty big change to make it analyse vendor code in the most recent php version in order to make sure it understand everything. I guess not impossible, but pretty far above what I'm comfortable with right now... |
Beta Was this translation helpful? Give feedback.
You absolutely can tell Psalm what version it must use for analysis: https://psalm.dev/docs/running_psalm/configuration/#phpversion
Psalm is not currently completely aware of what is vendor code and what is project code in some particular (but common cases), it would be a pretty big change to make it analyse vendor code in the most recent php version in order to make sure it understand everything. I guess not impossible, but pretty far above what I'm comfortable with right now...