Closed wallacio closed 9 months ago
Thanks for the report and sorry for the slow response. I don't know if I fully understand the problem here so I'll ask for some clarification.
Issues go stale after too much time without activity. If inactive for another 7 days this issue will be closed.
TLDR; make sure the extension has access to a valid PHP executable, and is executing phpstan in a way that makes sense to VSCode.
It's taken me a while to work out what's going wrong with my local environment, but for the benefit of future me and others:
Current config/use:
Extension version: pre-release (3.0.1?). The 'current' release didn't work at all - PHPStan binary couldn't be found (which is essentially the source of the problem).
Using VSCode on W11. The code repository is managed by Composer and phpstan/phpstan installed as require-dev in the project. The dev environment runs in Homestead, and a native PHP8 binary is available to VSCode in Windows to keep VSCode happy with linting etc. (I'm using Intelephense quite happily).
composer install
is run from a shell in Homestead, so that paths/permissions work.I can run phpstan happily via command in either WSL or Homestead with
vendor/bin/phpstan analyse
. There is aphpstan.neon
in the project root. The phpstan scripts (phpstan and phpstan.phar) in vendor/bin are PHP (rather than binaries).VSCode loads the extension, but this is what's show in the status bar: followed by
Output from 1-PHPStan Client.log:
This suggests that the extension is trying to do something, but actually it isn't.
After applying a bit of common sense I realise that VSCode has no idea what my dev environment looks like. Changing the
phpstan.binCommand
in settings to use the locally installed PHP binary, e.g.C:\PHP\php.exe vendor\bin\phpstan
has brought it to life. Hurrah.