Orders the interfaces in an implements
or interface extends
clause.
Risky for implements
when specifying both an interface and its parent
interface, because PHP doesn't break on parent, child
but does on child,
parent
.
How the interfaces should be ordered
Allowed values: 'alpha'
, 'length'
Default value: 'alpha'
Which direction the interfaces should be ordered
Allowed values: 'ascend'
, 'descend'
Default value: 'ascend'
Default configuration.
--- Original
+++ New
<?php
-final class ExampleA implements Gamma, Alpha, Beta {}
+final class ExampleA implements Alpha, Beta, Gamma {}
-interface ExampleB extends Gamma, Alpha, Beta {}
+interface ExampleB extends Alpha, Beta, Gamma {}
With configuration: ['direction' => 'descend']
.
--- Original
+++ New
<?php
-final class ExampleA implements Gamma, Alpha, Beta {}
+final class ExampleA implements Gamma, Beta, Alpha {}
-interface ExampleB extends Gamma, Alpha, Beta {}
+interface ExampleB extends Gamma, Beta, Alpha {}
With configuration: ['order' => 'length']
.
--- Original
+++ New
<?php
-final class ExampleA implements MuchLonger, Short, Longer {}
+final class ExampleA implements Short, Longer, MuchLonger {}
-interface ExampleB extends MuchLonger, Short, Longer {}
+interface ExampleB extends Short, Longer, MuchLonger {}
With configuration: ['order' => 'length', 'direction' => 'descend']
.
--- Original
+++ New
<?php
-final class ExampleA implements MuchLonger, Short, Longer {}
+final class ExampleA implements MuchLonger, Longer, Short {}
-interface ExampleB extends MuchLonger, Short, Longer {}
+interface ExampleB extends MuchLonger, Longer, Short {}