phpcbf is included when you install PHP_CodeSniffer. Tom McFarlin has written a nice guide on how to install PHP_CodeSniffer and the WordPress Coding Standards Rules for VSCode. If you follow this guide, phpcbf
will be installed in the project root, in ./vendor/bin/phpcbf
You'll find the convert.php script at GitHub
Add the content in tasks.json
to ./.vscode/tasks.json
. Make sure the paths are correct.
When you want to beautify PHP, or convert array()
to []
, on a Mac, hit Shift+Cmd+B
and select the task runner.
I learned about the phpcbf task runner from WraithKenny