I am facing this issue in Visual Studio Code. I have already tried reinstalling the phpcs extension but still facing this issue.
Unable to locat
I had the same issue, I did the following to fix it:
Install the phpcs by using composer with composer global require squizlabs/php_codesniffer
Press Command + ,
(Click Code -> Preferences -> Settings)
PHP CodeSniffer
'Scroll to 'Executatble Path
' and put
/Users/your-username/.composer/vendor/bin/phpcs
This fixed the issue for me, I hope it does for you too. Cheers!
In my case and in Windows 10, composer located at:
C:\Users\{user_name}\AppData\Roaming\Composer\vendor\bin\
and when i added this to VSCode settings at PHP CodeSniffer section this solve my problem.
My solution without the need to install php_codesniffer globally.
Just go to VSCode settings and define the local path ./vendor/squizlabs/php_codesniffer/bin/phpcs
Or you can set the path directly in your settings.json
"phpcs.executablePath": "./vendor/squizlabs/php_codesniffer/bin/phpcs"
open the project in the terminal and run this command
composer global require squizlabs/php_codesniffer
Hope that helps!
Install PHP Sniffer instead of phpcs
PHP Sniffer worked on the fly without any extra configuration
phpcs could not recognize my commands, despite a configured PATH, Composer & PHPCS installed.
The commands were recognized in the terminal, but not by the plugin (under windows 10)
From a GitHub comment.
If someone still needs help about this "Unable to locate phpcs ..." error message, try this: you just need to install
phpcs
globally via Composer.
- Install Composer from this resource if you don't have it,
After Composer is installed, open a command prompt wherever you want and run this command
composer global require squizlabs/php_codesniffer