From 97e6f677a6895a5193eb0396789716ec16225b3d Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 23 Jan 2026 17:13:46 +0100 Subject: [PATCH] ConstantStringType: prevent unnecessary work --- src/Type/Constant/ConstantStringType.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Type/Constant/ConstantStringType.php b/src/Type/Constant/ConstantStringType.php index 1b9e016c81..40d0773c48 100644 --- a/src/Type/Constant/ConstantStringType.php +++ b/src/Type/Constant/ConstantStringType.php @@ -209,15 +209,15 @@ public function isCallable(): TrinaryLogic return TrinaryLogic::createMaybe(); } - $phpVersion = PhpVersionStaticAccessor::getInstance(); $classRef = $reflectionProvider->getClass($matches[1]); if ($classRef->hasMethod($matches[2])) { - $method = $classRef->getMethod($matches[2], new OutOfClassScope()); - if ( - !$phpVersion->supportsCallableInstanceMethods() - && !$method->isStatic() - ) { - return TrinaryLogic::createNo(); + $phpVersion = PhpVersionStaticAccessor::getInstance(); + if (!$phpVersion->supportsCallableInstanceMethods()) { + $method = $classRef->getMethod($matches[2], new OutOfClassScope()); + + if (!$method->isStatic()) { + return TrinaryLogic::createNo(); + } } return TrinaryLogic::createYes();