Andrew Fletcher published: 11 May 2022 1 minute read
phpcs issue in Visual Studio Code, I'm receiving this warning in VS Code:
phpcs: Unable to locate phpcs. Please add phpcs to your global path or use composer decency manager to install it in your project locally.
How to fix
You can install phpcs by using composer global command:
composer global require squizlabs/php_codesnifferThen in VS Code, go to
Click Code -> Preferences -> Settings
Select User Settings and locate 'PHP CodeSniffer', or in the Search settings enter 'codesniffer'
Scroll down to 'Executatble Path' and add the following
/Users/{yourname}/.composer/vendor/bin/phpcsRemember to replace {yourname} with machine user name
Different issue, similar problem
Now the issue is
phpcs: Unable to locate phpcs. Command failed: /Users/{your name}/.composer/vendor/bin
How to fix
Restart VS Code