Add support for first class callables

This commit is contained in:
Fabien Potencier
2024-07-14 10:34:34 +02:00
parent 5036ab2a4a
commit d2eab12e70
4 changed files with 51 additions and 2 deletions
+2
View File
@@ -55,8 +55,10 @@ final class ReflectionCallable
$callable = [$object, $r->name];
$this->name = get_debug_type($object).'::'.$r->name;
} elseif (\PHP_VERSION_ID >= 80111 && $class = $r->getClosureCalledClass()) {
$callable = [$class->name, $r->name];
$this->name = $class->name.'::'.$r->name;
} elseif (\PHP_VERSION_ID < 80111 && $class = $r->getClosureScopeClass()) {
$callable = [\is_array($callable) ? $callable[0] : $class->name, $r->name];
$this->name = (\is_array($callable) ? $callable[0] : $class->name).'::'.$r->name;
} else {
$callable = $this->name = $r->name;