php-cs-fixer-config
php-cs-fixer-config copied to clipboard
Automatic version detection
This pull request adds a new ruleset, PhpAuto, that picks the right ruleset based on the minimum required PHP version defined in composer.json of the current working directory.
New dependencies added:
ext-json(backword compatible, since it was already required by php-cs-fixer)composer/semver(supported since PHP 5.3, so it should also be fine)
Additional Changes:
- project itself now uses the new ruleset (I figured it would be less maintenance + eating your own dog food)
- updated the readme file with the same reasoning; most people would want to automate this
Design Notes:
- at first I was going for a
PHP version -> ruleset class(e.g.[53 => Php53::class]) map but then I thought it would be less work to just add an interface and build the class name dynamically