File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1212
1313use function array_filter ;
1414use function array_map ;
15+ use function array_values ;
1516use function in_array ;
1617use function realpath ;
1718use function str_contains ;
@@ -39,11 +40,12 @@ public function testMethodsAreOrderedAlphabeticallyByVisibility($className): voi
3940 $ class = new ReflectionClass ($ className );
4041 $ methods = $ class ->getMethods ();
4142
42- $ methods = array_filter (
43+ $ methods = array_values ( array_filter (
4344 $ methods ,
4445 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+ ));
4749
4850 $ getSortValue = function (ReflectionMethod $ method ) {
4951 $ prefix = $ method ->isPrivate () ? '2 ' : ($ method ->isProtected () ? '1 ' : '0 ' );
You can’t perform that action at this time.
0 commit comments