PHP CodeSniffer include_once error
On my configuration the PHP/ path just wasn't where phpcs expected it.I solved it via creating symlink to the missing path.
go to pear directory and run:
ln -s share/pear/PHP/ PHP
I got this error when using PHP CodeSniffer installed via Composer.
Fixed it with:
cd /path/to/apprm -rf vendor/composer update
This is perhaps not the best solution, but it requires no change to your path or anything else.In the file phpcs you will find a section with:
if (is_file(dirname(__FILE__).'/../CodeSniffer/CLI.php') === true) { include_once dirname(__FILE__).'/../CodeSniffer/CLI.php';else { include_once 'PHP/CodeSniffer/CLI.php';}
Just add a new else if with your path to the correct file CLI.php (i.e. '/usr/local/pear/share/pear/PHP/CodeSniffer/CLI.php'):
if (is_file(dirname(__FILE__).'/../CodeSniffer/CLI.php') === true) { include_once dirname(__FILE__).'/../CodeSniffer/CLI.php';} else if (is_file('/usr/local/pear/share/pear/PHP/CodeSniffer/CLI.php')) { include_once '/usr/local/pear/share/pear/PHP/CodeSniffer/CLI.php';} else { include_once 'PHP/CodeSniffer/CLI.php';}
Last but not least document this change for later versions and updates.In the end the solution has to be that the developer of PHPCS makes a more solid construction for finding the CLI.php