From 309f82ad470a6c3ff18d32f9232cdc3613a82719 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 30 Dec 2023 20:21:21 +0100 Subject: [PATCH] Leverage ReflectionFunction::isAnonymous() --- Debug/WrappedListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Debug/WrappedListener.php b/Debug/WrappedListener.php index f23c963..11462df 100644 --- a/Debug/WrappedListener.php +++ b/Debug/WrappedListener.php @@ -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;