setRiskyAllowed(true) ->setRules([ '@Symfony' => true, '@Symfony:risky' => true, // Unambiguous wins. 'declare_strict_types' => true, 'no_unused_imports' => true, 'ordered_imports' => [ 'sort_algorithm' => 'alpha', 'imports_order' => ['class', 'function', 'const'], ], 'php_unit_method_casing' => ['case' => 'snake_case'], // Trailing commas in multiline constructs keep diffs to one line when // a parameter is appended — reviewable, and no reformat noise. 'trailing_comma_in_multiline' => [ 'elements' => ['arrays', 'arguments', 'parameters', 'match'], ], // `array()` → `[]`, consistent with everything else in these repos. 'array_syntax' => ['syntax' => 'short'], // Group imports so a file's dependency surface is scannable. 'global_namespace_import' => [ 'import_classes' => true, 'import_constants' => false, 'import_functions' => false, ], // Keep `#[Attribute]`-style attributes on their own line for long ones. 'attribute_empty_parentheses' => true, ]) ->setFinder( (new PhpCsFixer\Finder()) ->in(__DIR__) ->exclude('vendor') ->exclude('var') ->exclude('node_modules') // Migration classes are generated and version-stamped upstream; // reformatting them makes diffs against the generator noisy. ->notPath('src/Migrations') // Symfony's config reference is regenerated by `cache:clear`, which // composer runs on every install — so it is present in CI even // though it is gitignored. Formatting it makes the fixer report a // file the author cannot commit, and a fresh `cache:clear` // immediately undoes the fix, so CI can never go green. ->notPath('config/reference.php') ->ignoreDotFiles(true) ->ignoreVCS(true) );