PHP CS Fixer Hints in PhpStorm

An article a while back on about Tools to automatically format PHP, JavaScript and CSS files instructed you to make a .php_cs file in your project. This file defines the rules for how PHP CS Fixer should behave when run.


$finder = Symfony\Component\Finder\Finder::create()
    ->in(__DIR__ . '/src')

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

If you're using PhpStorm, it'll automatically start hinting at issues that PHP CS Fixer is flagging, offering automatic actions for potential fixes.

PhpStorm offering to fix PHP CS Fixer issues
Show Comments

Get the latest posts delivered right to your inbox.