Closed lcharette closed 7 months ago
What might explain the difference in behaviors might be that one of your devices is using the old version of the extension (2.0.X
) and the other the new version (3.0.X
). Can you check for me which one is using which? That could help me debug a bit.
That reported error does look like something PHPStan itself would spit out. Could you do these things?:
config.neon
file, that could help me verify that it looks goodphpstan.enableLanguageServer
setting (if it's not already off)I don't have access to the old laptop right now to confirm the version, but new one does have v3.0.7
Old laptop was indeed running 2.2.21, and the new one 3.0.7
$ /Users/malou/GitHub/userfrosting/framework/vendor/bin/phpstan analyse src/UserFrosting.php -c /Users/malou/GitHub/userfrost
ing/framework/phpstan.neon --error-format=json --no-interaction --memory-limit=1G
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
{"totals":{"errors":0,"file_errors":0},"files":[],"errors":[]}
3. Already disabled
Note 2.2.26 does work. Here's the log from 2.2.26. The file path is missing from the arguments in 3.0.7...
[check:10] Spawning PHPStan with the following configuration: {"binCmd":"/Users/malou/GitHub/userfrosting/framework/vendor/bin/phpstan","args":["analyse","-c","/Users/malou/GitHub/userfrosting/framework/phpstan.neon","--error-format=raw","--no-interaction","--memory-limit=1G","--no-progress","/Users/malou/GitHub/userfrosting/framework/src/UserFrosting.php"]}
[check:10] PHPStan process exited succesfully
Ah that sort of makes sense. At least one path should indeed be specified to analyze, and if your config.neon
does not specify one then one must be provided when running. The new version of the extension no longer does per-file checking since the author of PHPStan warns against doing so. Instead it checks the entire project at once, using the PHPStan-builtin cache to ensure only relevant files are checked.
How do you normally run this in something like a CI, where you want to check the entire project? Or do you only run this per individual file?
CI example can be found here : https://github.com/userfrosting/framework/blob/5.1/.github/workflows/PHPStan.yml
For my local workflow, I'm used to individual files being checked on save. But I'm open to improve to what's best.
Ah okay. I think this can be fixed pretty easily. If you add the src
and tests
directories as paths
in your phpstan.neon
then it'll work again. This will both allow you to remove those paths from the workflow file (since it automatically does those) and will still allow you to check individual files still if you provide them as commandline arguments. Let me know if that works!
Alright. This works, thanks for the quick support, very appreciated !
I've recently switched laptop and for some reason, this extension doesn't work on the new one. Note that both laptop are using the same config, the same PHP project, and the same PHPStan config. Nothing fancy, phpstan is in
vendor/bin/phpstan
, source code insrc/
, no Docker or anything similar. PHP installed locally using Homebrew on a Mac. A very basic setup, where everything should work out of the box.Complete error, using stock :
Same when doing a project scan :
Any tip ?