Skip to content

Commit 4fa5825

Browse files
Fix getting the name of closures on PHP 8.1.11+
1 parent a14cb68 commit 4fa5825

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ControllerMetadata/ArgumentMetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function createArgumentMetadata($controller): array
3333
$class = $reflection->class;
3434
} else {
3535
$reflection = new \ReflectionFunction($controller);
36-
if ($class = str_contains($reflection->name, '{closure}') ? null : $reflection->getClosureScopeClass()) {
36+
if ($class = str_contains($reflection->name, '{closure}') ? null : (\PHP_VERSION_ID >= 80111 ? $reflection->getClosureCalledClass() : $reflection->getClosureScopeClass())) {
3737
$class = $class->name;
3838
}
3939
}

DataCollector/RequestDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ private function parseController($controller)
479479
}
480480
$controller['method'] = $r->name;
481481

482-
if ($class = $r->getClosureScopeClass()) {
482+
if ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) {
483483
$controller['class'] = $class->name;
484484
} else {
485485
return $r->name;

0 commit comments

Comments
 (0)