Php-cs-fixer: "php-cs-fixer selfupdate" installed 2.0-DEV

Created on 4 Jun 2016  Â·  6Comments  Â·  Source: FriendsOfPHP/PHP-CS-Fixer

Just did a php-cs-fixer selfupdate and that gave me 2.0-DEV:

$ php-cs-fixer --version 
PHP CS Fixer version 2.0-DEV by Fabien Potencier and Dariusz Ruminski (d0d76b4)

Using the version I got by doing so does not work:

$ php-cs-fixer fix       

Fatal error: Uncaught Error: Class 'Symfony\CS\Finder\DefaultFinder' not found in /usr/local/src/phpunit/.php_cs on line 2

Error: Class 'Symfony\CS\Finder\DefaultFinder' not found in /usr/local/src/phpunit/.php_cs on line 2

Call Stack:
    0.0001     373696   1. {main}() /usr/local/bin/php-cs-fixer:0
    0.0349    4166688   2. Symfony\Component\Console\Application->run() /usr/local/bin/php-cs-fixer:37
    0.0359    4367144   3. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/php-cs-fixer/vendor/symfony/console/Application.php:117
    0.0360    4367144   4. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/php-cs-fixer/vendor/symfony/console/Application.php:186
    0.0360    4367144   5. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/php-cs-fixer/vendor/symfony/console/Application.php:791
    0.0361    4369080   6. PhpCsFixer\Console\Command\FixCommand->execute() phar:///usr/local/bin/php-cs-fixer/vendor/symfony/console/Command/Command.php:256
    0.0372    4478256   7. PhpCsFixer\Console\ConfigurationResolver->resolve() phar:///usr/local/bin/php-cs-fixer/src/Console/Command/FixCommand.php:306
    0.0375    4593872   8. PhpCsFixer\Console\ConfigurationResolver->resolveConfig() phar:///usr/local/bin/php-cs-fixer/src/Console/ConfigurationResolver.php:219
    0.0377    4602904   9. include('/usr/local/src/phpunit/.php_cs') phar:///usr/local/bin/php-cs-fixer/src/Console/ConfigurationResolver.php:384

Most helpful comment

Please see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/1925#issuecomment-266323864 for a full example config that fixes:

Fatal error: Class 'Symfony\CS\Finder\DefaultFinder' not found

and is compatible with both PHP-CS-Fixer 1.x and 2.x and works with Laravel 5.x.

All 6 comments

I didn't expect selfupdate to update to a non-stable...
The exception thrown is because the configuration file given is good for 1.x but cannot be used for 2.x.
(ref.: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/1749).
There are two work arounds I can think of;

Yes, I was quite surprised by selfupdate installing an unstable version. I have since reverted to the latest stable.

Turns out I did not revert back to the latest stable as I cannot find that. http://get.sensiolabs.org/php-cs-fixer.phar is 2.0-DEV.

As a sidenote, it would be really great if downloads of PHP Archives (PHARs) were made available on a site similar to https://phar.phpunit.de/. HTTPS, release archive, Phive metadata. You get the idea :-) Easy to set up using https://github.com/sebastianbergmann/phar-site-generator.

latest stable is here, hope it helps;
http://get.sensiolabs.org/php-cs-fixer-v1.11.phar

I would like to see the releases be a bit more organised for downloading and on HTTPS :)

Thank you @sebastianbergmann for your report.

I already started discussion about it with Fabien. Please be patient.

Closing as duplicate of #1925

Please see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/1925#issuecomment-266323864 for a full example config that fixes:

Fatal error: Class 'Symfony\CS\Finder\DefaultFinder' not found

and is compatible with both PHP-CS-Fixer 1.x and 2.x and works with Laravel 5.x.

Was this page helpful?
0 / 5 - 0 ratings