phpcbf complains about missing CodeSniffer but it appears to be missing from its own phar.
Ubuntu 14.04 using ondrej ppa for PHP 5.6
sudo pear install PHP_CodeSniffer
pear list
=> PHP_CodeSniffer 2.6.0 stable
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
php phpcbf.phar --version
=> PHP_CodeSniffer version 2.6.0 (stable) by Squiz (http://www.squiz.net)
php phpcbf.phar --standard=PSR2 ./MyDir/MyClass.php
PHP Warning: chdir(): No such file or directory (errno 2) in phar:///home/myuser/projects/myproject/src/phpcbf.phar/CodeSniffer.php on line 861
Update: Despite the warning, it seems to work fine.
PEAR is way out of date in 2017.
You should be using composer nowadays instead:
composer require squizlabs/php_codesniffer --dev
Then run like:
vendor/bin/phpcs ...
To get more details about PEAR timeout, there is RFC about PEAR removal for PHP 8.