New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
minor: Follow PSR12 ordered imports in Symfony ruleset #6712
Conversation
Pull Request Test Coverage Report for Build 3720836281
💛 - Coveralls |
I think we should get Sf deciders to make that call here. |
I'll ping @nicolas-grekas then |
Sorry I'm not sure I fully grasp what this would change. But yes, we list "use" in alpha order. class, function then const LGTM also. |
Cf https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/import/ordered_imports.rst#rule-sets, Symfony use ordered_imports with default config, which is
so it's loosing the PSR12 part
Which means that even if Symfony surely wants to respect the PSR12, the SymfonyRuleset doesn't fix this automatically. When Symfony override the rule to set the sort algorithm to alpha, we need to repeat the import order too. |
looks like there is an alignment ;) |
f39a7db
to
bb306e4
Compare
bb306e4
to
07ebcfb
Compare
I fixed the tests @keradus Btw, all ruleset will use at least It might be interesting to change the default value of the rule from
to
in next major then. Does it require a comment somewhere ? |
We use to add |
Thanks @julienfalque, it's done |
Thank you @VincentLanglet. |
PSR12 ordered imports is set this way
PHP-CS-Fixer/src/RuleSet/Sets/PSR12Set.php
Line 50 in ff49030
And Symfony extends the PSR12
PHP-CS-Fixer/src/RuleSet/Sets/SymfonySet.php
Line 27 in ff49030
but then when setting the ordered import, it's
true
PHP-CS-Fixer/src/RuleSet/Sets/SymfonySet.php
Line 136 in ff49030
Which means the previous config is lost, in order to have an
alpha
sort.IMHO both config should be used.
I would say it was never updated when Symfony moved from PSR2 to PSR12.
I'll fix test if this is accepted