Closed finn-matti closed 2 years ago
Oh I should also point out, that a restart generally seems to fix the issue.
Does running the commands phpcbf
and phpcs
multiple times produce the error? How about running the commands after the error shows up in VSCode?
Might be something funky happening with a dependency somewhere that needs a certain code path for the error to trigger 🤔
same issue for me, but I don't understand why phpcs binary needs to check composer config
also I use phpbrew and overwrite the OSX php native version with brew install php@7.4
and brew link php@7.4 --force --overwrite
so WHY still vscode found the php native version??
BTW my workaround is setting "platform-check": false
at composer.json
Does running the commands phpcbf and phpcs multiple times produce the error? How about running the commands after the error shows up in VSCode?
I'm not exactly sure how you meant this. But I ran into the problem again and ran phpcbf and phpcs in vs code's terminal three times each, without producing this error.
$ phpcs
ERROR: You must supply at least one file or directory to process.
Run "phpcs --help" for usage information
$ phpcbf
ERROR: You must supply at least one file or directory to process.
Run "phpcbf --help" for usage information
I think this is actually caused by the way macOS handles new terminal sessions, including those spawned by VSCode. Long story short, I previously fixed this issue by adding the following to my settings.json
:
"terminal.integrated.inheritEnv": false
You can read a little bit more about this in the VSCode docs and see the same issue over in the VSCode repo.
Thank you for that information, I'll take this as the work-around.
Describe the bug PHP Sniffer complains about a wrong config, specifically the php version, although the right is present. Error:
The right php is installed:
PHP is installed through phpbrew:
And the right php is also in my path first:
To be clear. This message doesn't always appear, but is in any case wrong.
To Reproduce Not sure yet. Especially since it doesn't consistently happen. But I'm happy to investigate.
Expected behavior No error.
Environment
Extension settings