diff --git a/tests/PedantryTest.php b/tests/PedantryTest.php index 2885d82a7..a46477d94 100644 --- a/tests/PedantryTest.php +++ b/tests/PedantryTest.php @@ -33,7 +33,8 @@ public function testMethodsAreOrderedAlphabeticallyByVisibility($className): voi $methods = array_filter( $methods, function (ReflectionMethod $method) use ($class) { - return $method->getDeclaringClass() == $class; + return $method->getDeclaringClass() == $class // Exclude inherited methods + && $method->getFileName() === $class->getFileName(); // Exclude methods inherited from traits } ); @@ -86,7 +87,8 @@ public function provideProjectClassNames() continue; } - $classNames[][] = 'MongoDB\\' . str_replace(DIRECTORY_SEPARATOR, '\\', substr($file->getRealPath(), strlen($srcDir) + 1, -4)); + $className = 'MongoDB\\' . str_replace(DIRECTORY_SEPARATOR, '\\', substr($file->getRealPath(), strlen($srcDir) + 1, -4)); + $classNames[$className][] = $className; } return $classNames;