Skip to content

Commit

Permalink
Exclude methods inherited from traits in PedantryTest
Browse files Browse the repository at this point in the history
This commit also uses dataset names for better visibility during debugging
  • Loading branch information
alcaeus committed Jul 7, 2023
1 parent df23368 commit 36c0c20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/PedantryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 36c0c20

Please sign in to comment.