erickskrauch/php-cs-fixer-custom-fixers
Custom PHP-CS-Fixer fixers by Erick Skrauch. Adds opinionated formatting rules like aligning multiline parameters, inserting blank lines around class bodies and before returns, spacing after control statements, fixing multiline if braces, ordering overrides, and Yii2 ::className() replacement.
composer require --dev erickskrauch/php-cs-fixer-custom-fixerscomposer require --dev friendsofphp/php-cs-fixer.php-cs-fixer.php config file:
$finder = PhpCsFixer\Finder::create()
->in(__DIR__);
return (new PhpCsFixer\Config())
->setRules([
// your existing rules...
])
->setFinder($finder)
->setCustomFixers([new \ErickSkrauch\PhpCsFixer\CustomFixers\Fixer\ClassOrderFixer()]);
Note: You must explicitly instantiate and register each fixer you want to use—no auto-discovery.NoDuplicateProperty.php, ClassOrderFixer, ExplicitPublicMethodFixer) and gradually add more as conventions evolve../vendor/bin/php-cs-fixer fix --dry-run) to fail builds if custom rules are violated.husky + lint-staged (in JS stacks) or pre-commit (in Python/Go toolchains) to run php-cs-fixer fix on staged PHP files only..php-cs-fixer.php config in the repo, and document added fixers in CONTRIBUTING.md to avoid confusion.new’d and added to setCustomFixers().--dry-run and --diff during initial rollout to audit changes.XDEBUG_MODE=off before running to avoid performance penalties; custom fixers can be slow if they use heavy regex or AST traversal.src/Fixer/ for baseline examples.How can I help you explore Laravel packages today?