mfn/php-cs-fixer-config
Opinionated PHP-CS-Fixer ruleset for v3.11+ via a simple \Mfn\PhpCsFixer\Config::getRules() helper. Requires setRiskyAllowed(true). Minimal repo with issues disabled—PRs welcome to discuss technical changes.
nullable_type_declaration_for_default_null_value), ensuring compatibility with modern PHP features without manual configuration.ordered_imports and nullable_type_declaration optimize Laravel-specific patterns (e.g., Facade usage, dependency injection), reducing technical debt in core frameworks and third-party packages.Adopt this package when:
Avoid this package if:
src/Config.php) and verify the maintainer’s legitimacy before adoption.strict_types, declare_strict_types) or override defaults frequently.setRiskyAllowed(true), which could introduce breaking changes (e.g., native_function_invocation). Validate rules thoroughly before adoption.*"This package standardizes code formatting across all Laravel applications with zero upfront engineering cost. By adopting this pre-configured PHP-CS-Fixer setup, we’ll:
Risk: Minimal—this is a drop-in replacement for existing PHP-CS-Fixer configs. We’ll pilot it in [Project Z] and measure impact before scaling. The package’s opinionated nature reduces technical debt by enforcing consistency at scale, while the Laravel-specific rules optimize our existing codebase.
Next Steps:
*"This is a ready-to-use PHP-CS-Fixer config tailored for Laravel:
composer.json and run php-cs-fixer fix in your pipeline.How to start:
composer require --dev mfn/php-cs-fixer-config
.php-cs-fixer.php with:
require 'vendor/autoload.php';
return \Mfn\PhpCsFixer\Config::getRules();
./vendor/bin/php-cs-fixer fix
Pro tip: Extend the config for project-specific needs:
$rules = \Mfn\PhpCsFixer\Config::getRules();
$rules['phpdoc_summary'] = false; // Disable if needed
return (new PhpCsFixer\Config())->setRules($rules);
Warning: This enables setRiskyAllowed(true), which may introduce breaking changes. Audit the rules before adoption—especially in critical paths like Facade usage or dependency injection.
Pilot Plan:
*"Architectural Fit:
Pros:
ordered_imports and nullable_type_declaration optimize Laravel-specific patterns (e.g., Facade usage, dependency injection), reducing technical debt..php-cs-fixer.php with a single method call, leveraging Laravel’s Composer autoloading.Cons:
src/Config.php and repository legitimacy before adoption.setRiskyAllowed(true) introduces potential breaking changes (e.g., native_function_invocation, no_unused_imports), requiring validation against project-specific logic.Recommendation:
Auth::user()).How can I help you explore Laravel packages today?