How do you configure PHP-CS-Fixer?

I've added a .php_cs file to my project's root folder, containing this:

$finder = PhpCsFixer\Finder::create()

return PhpCsFixer\Config::create()
'@PSR2' => true,
'full_opening_tag' => true,
'array_syntax' => ['syntax' => 'short'],

Yet, phpStorm does not load this configuration and does not use this file to set the rules. How do I make phpStorm use the correct rules?

1 comment
Comment actions Permalink

I figured it out. From Preferences -> Editor > Inspections > PHP > Quality tools > PHP CS Fixer Validation -> Custom ruleset, then the three dots and set the path to your .php_cs file.

I still think it should be the default behaviour to look for a .php_cs file in the project root, but I can work with this :)


Please sign in to leave a comment.