Skip to content

Commit

Permalink
Leverage ReflectionFunction::isAnonymous()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Dec 30, 2023
1 parent 098b62a commit 309f82a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Debug/WrappedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(callable|array $listener, ?string $name, Stopwatch $
$this->callableRef .= '::'.$listener[1];
} elseif ($listener instanceof \Closure) {
$r = new \ReflectionFunction($listener);
if (str_contains($r->name, '{closure}')) {
if ($r->isAnonymous()) {
$this->pretty = $this->name = 'closure';
} elseif ($class = $r->getClosureCalledClass()) {
$this->name = $class->name;
Expand Down

0 comments on commit 309f82a

Please sign in to comment.