diff --git a/src/Utils/Callback.php b/src/Utils/Callback.php index 732af9670..f365888e8 100644 --- a/src/Utils/Callback.php +++ b/src/Utils/Callback.php @@ -94,7 +94,7 @@ public static function toReflection($callable): \ReflectionMethod|\ReflectionFun } if (is_string($callable) && str_contains($callable, '::')) { - return new ReflectionMethod($callable); + return PHP_VERSION_ID < 80300 ? new ReflectionMethod($callable) : ReflectionMethod::createFromMethodName($callable); } elseif (is_array($callable)) { return new ReflectionMethod($callable[0], $callable[1]); } elseif (is_object($callable) && !$callable instanceof \Closure) { diff --git a/src/Utils/Reflection.php b/src/Utils/Reflection.php index 5a4f2ab75..8ad3aa9bf 100644 --- a/src/Utils/Reflection.php +++ b/src/Utils/Reflection.php @@ -100,7 +100,7 @@ public static function getMethodDeclaringMethod(\ReflectionMethod $method): \Ref $hash = [$method->getFileName(), $method->getStartLine(), $method->getEndLine()]; if (($alias = $decl->getTraitAliases()[$method->name] ?? null) - && ($m = new \ReflectionMethod($alias)) + && ($m = PHP_VERSION_ID < 80300 ? new \ReflectionMethod($alias) : \ReflectionMethod::createFromMethodName($alias)) && $hash === [$m->getFileName(), $m->getStartLine(), $m->getEndLine()] ) { return self::getMethodDeclaringMethod($m);