kubawerlos/php-cs-fixer-custom-fixers
Adds a curated set of custom fixers for PHP-CS-Fixer to enforce consistent, opinionated code style beyond the built-in rules. Plug in the fixers, combine with your config, and keep large PHP codebases clean and uniform.
composer require --dev kubawerlos/php-cs-fixer-custom-fixers.composer require --dev friendsofphp/php-cs-fixer..php-cs-fixer.php config file (e.g., below standard config setup):
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
return (new PhpCsFixer\Config())
->setRules([
// Enable custom fixers by name
'kubawerlos/no_superfluous_elseif' => true,
'kubawerlos/strict_param_call' => true,
// ...other rules...
])
->setFinder($finder);
./vendor/bin/php-cs-fixer fix --dry-run to preview changes before applying.kubawerlos/strict_param_call) to avoid runtime type coercion bugs.no_superfluous_elseif, single_line_after_imports) and gradually expand.rules config for readability:
'rules' => [
'@PSR12' => true,
'kubawerlos/no_superfluous_elseif' => true,
'kubawerlos/strict_comparison' => true,
'kubawerlos/no_useless_else' => true,
]
--diff --dry-run in CI (GitHub Actions, GitLab CI) to fail builds on style violations—no changes needed in Docker container unless fixing.kubawerlos/concat_space enforces str . $var vs str.$var).kubawerlos/. Forgetting the prefix (e.g., no_superfluous_elseif → kubawerlos/no_superfluous_elseif) causes silently ignored rules—check logs with --verbose.kubawerlos/strict_comparison may conflict with @Symfony rules around == vs ===). Use php-cs-fixer fix --diff --dry-run to inspect side effects.'verbose' => true in config or run with --debug to trace fixer execution—especially helpful when a rule should fire but doesn’t.^3.0) since new fixers may break builds unexpectedly—review changelog before upgrades.How can I help you explore Laravel packages today?