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();