Php Codesniffer and WP Coding Standards

This seems to be the most useful reference so far: https://jasonyingling.me/setting-up-wordpress-coding-standards-in-visual-studio-code/.

Some useful commands:

composer global require squizlabs/PHP_Codesniffer
brew install php-code-sniffer
brew remove php-code-sniffer
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths ~/.composer/vendor/wp-coding-standards/wpcs ~/.composer/vendor/squizlabs/php_codesniffer
phpcs -e
phpcs --config-show
phpcs --extensions=php --standard=PSR12 .
phpcs --standard=phpcs.somefile.xml --extensions=php --standard=PSR12 .
phpcbf 

Of course the docs.

Leave a Reply

Your email address will not be published. Required fields are marked *