diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index d21029d58131..71535fe83ff8 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -676,12 +676,20 @@ public function call($callback, array $parameters = [], $defaultMethod = null) */ protected function getClassForCallable($callback) { - if (is_callable($callback) && - ! ($reflector = new ReflectionFunction($callback(...)))->isAnonymous()) { - return $reflector->getClosureScopeClass()->name ?? false; + if (PHP_VERSION_ID >= 80200) { + if (is_callable($callback) && + ! ($reflector = new ReflectionFunction($callback(...)))->isAnonymous()) { + return $reflector->getClosureScopeClass()->name ?? false; + } + + return false; + } + + if (! is_array($callback)) { + return false; } - return false; + return is_string($callback[0]) ? $callback[0] : get_class($callback[0]); } /**