Skip to content

Commit 55733a8

Browse files
Fix getting the name of closures on PHP 8.1.11+
1 parent 571334c commit 55733a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

LazyString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private static function getPrettyName(callable $callback): string
148148
} elseif ($callback instanceof \Closure) {
149149
$r = new \ReflectionFunction($callback);
150150

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

0 commit comments

Comments
 (0)