Skip to content

Commit

Permalink
Do not pass null to ReflectionClass::getMethods()
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemkose committed Jul 29, 2022
1 parent 9edbd2e commit b276edb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Util/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ private function filterMethods(ReflectionClass $class, ?int $filter): array
{
$methods = [];

foreach ($class->getMethods($filter) as $method) {
// PHP <7.2.18 and <7.3.5 throw error when null is passed
// to ReflectionClass::getMethods() when strict_types is enabled.
$classMethods = $filter === null ? $class->getMethods() : $class->getMethods($filter);

foreach ($classMethods as $method) {
if ($method->getDeclaringClass()->getName() === TestCase::class) {
continue;
}
Expand Down

0 comments on commit b276edb

Please sign in to comment.