diff --git a/src/NodeContainer/ParsedNodesByType.php b/src/NodeContainer/ParsedNodesByType.php index 59f054109443..b4b992b7d6ed 100644 --- a/src/NodeContainer/ParsedNodesByType.php +++ b/src/NodeContainer/ParsedNodesByType.php @@ -379,6 +379,11 @@ public function isStaticMethod(string $methodName, string $className): bool return true; } + // probably magic method → we don't know + if (! method_exists($className, $methodName)) { + return false; + } + $methodReflection = $reflectionClass->getMethod($methodName); return $methodReflection->isStatic(); }