How to create custom ruleset to be run by fix
command with option --rules=@custom
?
Like @PSR1
, @PSR2
, @Symfony
, @PHP56Migration
, @PHP70Migration
, @PHP71Migration
are made.
Php-cs-fixer version: 2.2.3
Only by inserting into vendor code -vendor/friendsofphp/php-cs-fixer/src/RuleSet.php
:
private $setDefinitions = array(
'@custom' => [
'some_custom_fixer` => true,
]
)
Works as I expect, but RuleSet
is final class
. Is there a way to override or extend the setDefinitions
when using custom config .php_cs
?
Currently, there is no way to register custom ruleset how you register custom fixer. Although that, we were already thinking that it would be nice to introduce it, yet it is not a prio on our todo list. Feel free to write proposal how it shall be handled, and PR after initial discussion. https://github.com/FriendsOfPHP/PHP-CS-Fixer/
In the meanwhile, create your own configuration instead and share it across projects.
For example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With