Skip to content

Commit

Permalink
fix method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 3, 2023
1 parent de8d515 commit e511a3b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

/**
Expand Down

0 comments on commit e511a3b

Please sign in to comment.