Reputation: 3490
Okay, I know php-cs-fixer
allows following levels of fixes for coding standards:
php php-cs-fixer.phar fix /path/to/project --level=psr0
php php-cs-fixer.phar fix /path/to/project --level=psr1
php php-cs-fixer.phar fix /path/to/project --level=psr2
php php-cs-fixer.phar fix /path/to/project --level=symfony
I know that psr0
, psr1
, psr2
levels maintain specified coding standards.
But I want to know what --level=symfony
offers and how does that coding standard differ from psr2
.
Also if we don't the provide the --level
option at all. Does is assume --level=psr2
by default?
Upvotes: 8
Views: 6620
Reputation: 24280
Now in 2017, since version 2, you can use describe
command.
vendor/bin/php-cs-fixer describe @PSR2
It shows you current fixers in the ruleset with names and description:
So for "Symfony" ruleset it would look like:
vendor/bin/php-cs-fixer describe @Symfony
And for single rule like:
vendor/bin/php-cs-fixer describe some_rule
Also notice level
option was deprecated. Use it as rule, just with @
prefix instead.
vendor/bin/php-cs-fixer --rules=@PSR2
If you look for more details, see related PR.
Upvotes: 4
Reputation: 3490
Here's a good blog post on using php-cs-fixer
and here it implies that by default it uses psr2
fixers if the --level
option is not provided.
But, if we pass --level=symfony
explicitly it runs some “additional” checks, which are targeted at Symfony and go above-and-beyond PSR2
By default, it runs “all PSR-2 fixers and some additional ones.” You can toggle the level you want to run with the --level flag, which I’ll be setting to psr2 so that the “additional” checks, which are targeted at Symfony and go above-and-beyond PSR2, don’t throw me off. (It runs the entire stack by default, which is called level “symfony” and includes things like “Align equals signs in subsequent lines”).
Also the php-cs-fixer README on github provides some information about the filters that are run in PSR-0, PSR-1, PSR-2 and symfony.
Upvotes: 1
Reputation: 1799
As I see from this document https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/1.8/README.rst it executes this list of filters:
Upvotes: 1