File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,9 @@ class ClassReflection
142
142
/** @var array<string, true> */
143
143
private static array $ resolvingTypeAliasImports = [];
144
144
145
+ /** @var array<string, bool> */
146
+ private array $ hasMethodCache = [];
147
+
145
148
/**
146
149
* @param PropertiesClassReflectionExtension[] $propertiesClassReflectionExtensions
147
150
* @param MethodsClassReflectionExtension[] $methodsClassReflectionExtensions
@@ -482,16 +485,26 @@ public function hasProperty(string $propertyName): bool
482
485
483
486
public function hasMethod (string $ methodName ): bool
484
487
{
488
+ if (array_key_exists ($ methodName , $ this ->hasMethodCache )) {
489
+ return $ this ->hasMethodCache [$ methodName ];
490
+ }
491
+
485
492
foreach ($ this ->methodsClassReflectionExtensions as $ extension ) {
486
493
if ($ extension ->hasMethod ($ this , $ methodName )) {
494
+ $ this ->hasMethodCache [$ methodName ] = true ;
495
+
487
496
return true ;
488
497
}
489
498
}
490
499
491
500
if ($ this ->requireExtendsMethodsClassReflectionExtension ->hasMethod ($ this , $ methodName )) {
501
+ $ this ->hasMethodCache [$ methodName ] = true ;
502
+
492
503
return true ;
493
504
}
494
505
506
+ $ this ->hasMethodCache [$ methodName ] = false ;
507
+
495
508
return false ;
496
509
}
497
510
You can’t perform that action at this time.
0 commit comments