Skip to content

Commit 796775b

Browse files
committed
fixed EnumMethodsClassReflectionExtension::hasMethod
1 parent 4c40ab2 commit 796775b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/EnumMethodsClassReflectionExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class EnumMethodsClassReflectionExtension implements MethodsClassReflectionExten
1212
public function hasMethod(ClassReflection $classReflection, string $methodName): bool
1313
{
1414
if ($classReflection->isSubclassOf(Enum::class)) {
15-
$array = $classReflection->getNativeReflection()->getMethod('getConstants')->invoke(null);
16-
17-
return array_key_exists($methodName, $array);
15+
return false;
1816
}
1917

20-
return false;
18+
/** @var string|Enum $class */
19+
$class = $classReflection->getName();
20+
return array_key_exists($methodName, $class::getConstants());
2121
}
2222

2323
public function getMethod(ClassReflection $classReflection, string $methodName): MethodReflection

0 commit comments

Comments
 (0)