Skip to content

Commit 37eb67c

Browse files
committed
Exclude methods inherited from traits in PedantryTest
This commit also uses dataset names for better visibility during debugging
1 parent cf3a5ea commit 37eb67c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/PedantryTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public function testMethodsAreOrderedAlphabeticallyByVisibility($className): voi
3333
$methods = array_filter(
3434
$methods,
3535
function (ReflectionMethod $method) use ($class) {
36-
return $method->getDeclaringClass() == $class;
36+
return $method->getDeclaringClass() == $class // Exclude inherited methods
37+
&& $method->getFileName() === $class->getFileName(); // Exclude methods inherited from traits
3738
}
3839
);
3940

@@ -86,7 +87,8 @@ public function provideProjectClassNames()
8687
continue;
8788
}
8889

89-
$classNames[][] = 'MongoDB\\' . str_replace(DIRECTORY_SEPARATOR, '\\', substr($file->getRealPath(), strlen($srcDir) + 1, -4));
90+
$className = 'MongoDB\\' . str_replace(DIRECTORY_SEPARATOR, '\\', substr($file->getRealPath(), strlen($srcDir) + 1, -4));
91+
$classNames[$className][] = $className;
9092
}
9193

9294
return $classNames;

0 commit comments

Comments
 (0)