Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.59.3) edition

Rule ordered_traits

Trait use statements must be sorted alphabetically.


Using this rule is risky

Risky when depending on order of the imports.



Whether the sorting should be case sensitive.

Allowed types: bool

Default value: false


Example #1

Default configuration.

--- Original
+++ New
 <?php class Foo {
-use Z; use A; }
+use A; use Z; }

Example #2

With configuration: ['case_sensitive' => true].

--- Original
+++ New
 <?php class Foo {
-use Aaa; use AA; }
+use AA; use Aaa; }

Rule sets

The rule is part of the following rule sets:


The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.