OrderedImportsFixer should have a blankLineBetweenGroups config option, which when used together with
'importsOrder' => ['class', 'function', 'const']
would allow adherence to the draft PSR-12.
Example taken from the draft PSR:
use Vendor\Package\{ClassA as A, ClassB, ClassC as C};
use Vendor\Package\SomeNamespace\ClassD as D;
use Vendor\Package\AnotherNamespace\ClassE as E;
use function Vendor\Package\{functionA, functionB, functionC};
use function Another\Vendor\functionD;
use const Vendor\Package\{CONSTANT_A, CONSTANT_B, CONSTANT_C};
use const Another\Vendor\CONSTANT_D;
I do believe that it could be achieved as separated fixer (that fix only one thing instead of all different issues with imports)
Maybe, a new fixer in combination with #3586, sth like grouped_imports, that:
shall run after ordered_imports
@keradus the problem with your proposed fixer is that if first ordered_imports is run, it orders the imports with the "flaw" as described in #3586 and when the new fixer then "collects all imports in given namespace to put them together" it either becomes unordered, or it needs to again do things that ordered_imports already does (figuring out exactly where in the sort-order it should be, and thus needing the config of ordered_imports as well).
Therefore they need to become 3 fixers (run in this order):
ordered_imports for sorting themUnless you add the last as option to ordered_imports like this feature request describes 馃槈
What's the status here?
Most helpful comment
I do believe that it could be achieved as separated fixer (that fix only one thing instead of all different issues with imports)
Maybe, a new fixer in combination with #3586, sth like
grouped_imports, that:shall run after
ordered_imports