Search code examples
phpwordpressphpcs

phpcbf doesn't see installed phpcs standard


I’ve installed the WordPress Coding Standards for phpcs. Running phpcs -i confirms this:

The installed coding standards are MySource, PEAR, PHPCS, 
PSR1, PSR2, Squiz, Zend, WordPress, WordPress-Core, 
WordPress-Docs, WordPress-Extra and WordPress-VIP

However, running phpcbf -i it would seem that phpcbf doesn't see these:

The installed coding standards are MySource, PEAR, PSR1, 
PSR2, Squiz and Zend

Trying to run the --config_set installed_paths that I used on phpcs on phpcbf results in errors upon running phpcbf.

How can I get phpcbf to use the WordPress Coding Standards I’ve installed for phpcs?

I’m on macOS Sierra 10.12.5


Solution

  • Greg Sherwood’s comment above pointed me in the right direction. The two commands were symlinks pointing at different installs. I figured this out by running which phpcs and which phpcbf and running readlink (to see if they were symlinks) on the results.

    which phpcs gave me /usr/local/bin/phpcs and readlink /usr/local/bin/phpcs gave me the path to the actual executable.

    Once I figured out that phpcbf was a symlink to an executable in a different install I deleted it and replaced it with a symlink to phpcbf in the same install as phpcs, which solved my issue.