PHP CS Fixer 2.x deprecated - fails to run

I've just updated to PHP CS Fixer 2.19.2, and it now triggers a deprecation warning (since 3.x was released earlier this year.)

I'm not quite ready to shift to 3.x as there's migration work involved, but may have no choice because PHPStorm can no longer run PHP CS Fixer, throwing the following error in the console:

PHP CS Fixer: You are running PHP CS Fixer v2, which is not maintained anymore. Please update to v3.
If you need help while solving warnings, ask at, we will help you!
PHP CS Fixer 2.19.2 Testament by Fabien Potencier and Dariusz Ruminski
Runtime: PHP 8.0.7
In Utils.php line 197:
Your are using something deprecated, see previous exception. Aborting execu

Is there a way to get PHPStorm to ignore this warning for the time being?

Comment actions Permalink

It's not the warning that stops PhpStorm from parsing the output, the entire PHP process stops with a runtime exception.
I've just tried to reproduce that locally on 2.19.2, and despite the warning, PHP CS Fixer works just fine for me both in PhpStorm 2021.2.2 and in the terminal.

Can you run PHP CS Fixer in the terminal?

Comment actions Permalink

Ah, you're onto something! It appears that PHPStorm runs PHP CS Fixer with the `PHP_CS_FIXER_FUTURE_MODE` environment flag turned on, but cuts off the resulting deprecation errors before it can explain what the issue was (despite referring to it as the 'previous' exception, it means the one that follows.)

Thankfully there were only a couple of deprecation errors in my project, so I was able to get it all up and running again with relative ease. For folks with less straightforward errors, hopefully there'll be a way to influence the flags passed by PHPStorm in a future release!

Comment actions Permalink


This should give you some more info on why PHP_CS_FIXER_FUTURE_MODE is used:

If you think that there are issues or something can be improved for such cases -- please file a ticket at PhpStorm Issue Tracker .


Please sign in to leave a comment.