Skip to content

Commit 7961d8c

Browse files
committed
Add failing test for use-order rule when using a trait
The error which is reported: ( [message] => use found on line 48, but require was declared on line 7. Statements should be ordered `namespace`, `use`, `const`, `require`, then code. [source] => HM.Layout.Order.WrongOrder [listener] => HM\Sniffs\Layout\OrderSniff [severity] => 5 [fixable] => ) It should be possible to `use` a trait within a class, without triggering the warning for a top-level namespace `use` statement.
1 parent ce200ea commit 7961d8c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/fixtures/pass/use-order.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use Foo\Bar;
44
use Foo\Baz as Zztop;
5+
use Some_Trait;
56

67
require( 'some/file/that/exists.php' );
78

@@ -42,3 +43,7 @@
4243
$c = function() {
4344
return true;
4445
};
46+
47+
class My_Class {
48+
use Some_Trait;
49+
}

0 commit comments

Comments
 (0)