Skip to content

Commit

Permalink
Fix getting the name of closures on PHP 8.1.11+
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Dec 12, 2022
1 parent 571334c commit 55733a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion LazyString.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private static function getPrettyName(callable $callback): string
} elseif ($callback instanceof \Closure) {
$r = new \ReflectionFunction($callback);

if (false !== strpos($r->name, '{closure}') || !$class = $r->getClosureScopeClass()) {
if (false !== strpos($r->name, '{closure}') || !$class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) {
return $r->name;
}

Expand Down

0 comments on commit 55733a8

Please sign in to comment.