Open Krunch opened 3 years ago
It's not 100% ignored, because when I change the name in fixer.php
I see that change. But it fully ignores the rules, always resorting to the default rules of PHP-CS-Fixer: ['@PSR12' => true];
.
Inside the Resolver I added after this line:
$config = $config ?: new Config(config('fixer.config_name', 'Laravel'));
The following line:
$config->setRules($options['rules'] ?: config('fixer.rules'));
That loads the rules
from fixer.rules
but then indeed I run into issues with the naming of several rules as you also mentioned.
Then afterwards I have to rewrite about 10 rules to match the v3 syntax indeed.
@bubba-h57 Is this something you are working on? I'm not using this package very heavily so I'm not sure if submitting a PR without internal knowledge would be the best way of solving this.
Can somebody look after this issue, I tried to add some rules but it didn't work as expected.
The new config file in the PR looks good, however, it won't solve the main issue.
Adding the line what @stefandoorn provided will solve the main issue.
Inside the Resolver I added after this line:
$config = $config ?: new Config(config('fixer.config_name', 'Laravel'));
The following line:
$config->setRules($options['rules'] ?: config('fixer.rules'));
Thanks!
I am trying to customize the
config/fixer.php
that this package generates to tweak some of the rules, but they are completely ignored. No matter what I change in that file, none of the changes get picked up. Also, thefixer.php
still uses rule names from the old php-cs-fixer version 2. For examplelowercase_constants
should now beconstant_case
.If I reimplement the rules as-is (no changes) inside a
.php-cs-fixer.dist.php
file and then run this commandphp artisan fixer:fix --config=.php-cs-fixer.dist.php
then it clearly errors out with this error:So there seems to be 2 issues currently:
config/fixer.php
that can be generated through the package is completely ignored.fixer.php
file haven't been updated to use the new php-cs-fixer version 3 names.