File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,13 @@ class EnumMethodsClassReflectionExtension implements MethodsClassReflectionExten
1111{
1212 public function hasMethod (ClassReflection $ classReflection , string $ methodName ): bool
1313 {
14- if ($ classReflection ->isSubclassOf (Enum::class)) {
15- $ array = $ classReflection ->getNativeReflection ()->getMethod ('getConstants ' )->invoke (null );
16-
17- return array_key_exists ($ methodName , $ array );
14+ if (!$ classReflection ->isSubclassOf (Enum::class)) {
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
You can’t perform that action at this time.
0 commit comments