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 a44a9e8 commit f85a857
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions 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 f85a857

Please sign in to comment.