File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 12
12
13
13
use function array_filter ;
14
14
use function array_map ;
15
+ use function array_values ;
15
16
use function in_array ;
16
17
use function realpath ;
17
18
use function str_contains ;
@@ -39,11 +40,12 @@ public function testMethodsAreOrderedAlphabeticallyByVisibility($className): voi
39
40
$ class = new ReflectionClass ($ className );
40
41
$ methods = $ class ->getMethods ();
41
42
42
- $ methods = array_filter (
43
+ $ methods = array_values ( array_filter (
43
44
$ methods ,
44
45
fn (ReflectionMethod $ method ) => $ method ->getDeclaringClass () == $ class // Exclude inherited methods
45
- && $ method ->getFileName () === $ class ->getFileName (), // Exclude methods inherited from traits
46
- );
46
+ && $ method ->getFileName () === $ class ->getFileName () // Exclude methods inherited from traits
47
+ && ! ($ method ->isConstructor () && ! $ method ->isPublic ()), // Exclude non-public constructors
48
+ ));
47
49
48
50
$ getSortValue = function (ReflectionMethod $ method ) {
49
51
$ prefix = $ method ->isPrivate () ? '2 ' : ($ method ->isProtected () ? '1 ' : '0 ' );
You can’t perform that action at this time.
0 commit comments