Php-cs-fixer: [Feature request] Order of class interfaces

Created on 14 Nov 2018  ·  7Comments  ·  Source: FriendsOfPHP/PHP-CS-Fixer

Having the following input:

<?php

class Example implements CheckInterface, AuthInterface {}

a ordered_implements rule should order the import alphanumerically to achieve the following output:

<?php

class Example implements AuthInterface, CheckInterface {}

Other orders could be length and none (identical to ordered_imports).

This rule should not be risky, as interfaces cannot overwrite each other when being implemented.

easy pick kinfeature request

All 7 comments

In the case of ordered_imports sorting on none has at least the grouping.
Would a none option here not have the same effect as just not enabling the fixer?

In the case of ordered_imports sorting on none has at least the grouping.

which is a bug that will be fixed very soon by a PR of mine ;) @ see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/2696#issuecomment-296082422

Would a none option here not have the same effect as just not enabling the fixer?

Maybe to disable the fixer in an subsequent rule?
E.g. the Symfony ruleset enables the fixer but you don't want it, as such you set it explicitly to none.

In the case of ordered_imports sorting on none has at least the grouping.

which is a bug that will be fixed very soon by a PR of mine ;) @ see #2696 (comment)

I was talking about sort function, which in case of your comment is alpha, not none.

Would a none option here not have the same effect as just not enabling the fixer?

Maybe to disable the fixer in an subsequent rule?
E.g. the Symfony ruleset enables the fixer but you don't want it, as such you set it explicitly to none.

In this case you would set the rule to false, not the config of the rule to none.

Would a none option here not have the same effect as just not enabling the fixer?

Maybe to disable the fixer in an subsequent rule?
E.g. the Symfony ruleset enables the fixer but you don't want it, as such you set it explicitly to none.

In this case you would set the rule to false, not the config of the rule to none.

Right, maybe the none option is useless if no one finds a valid reason for this.

I created a PR for this: #4113 😄

Was this page helpful?
0 / 5 - 0 ratings