Skip to content

Commit 497f73a

Browse files
Don't enable tracing unless the profiler is enabled
1 parent 045a5ba commit 497f73a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Debug/TraceableEventDispatcher.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(
4343
protected Stopwatch $stopwatch,
4444
protected ?LoggerInterface $logger = null,
4545
private ?RequestStack $requestStack = null,
46+
protected readonly ?\Closure $disabled = null,
4647
) {
4748
}
4849

@@ -103,6 +104,9 @@ public function hasListeners(?string $eventName = null): bool
103104

104105
public function dispatch(object $event, ?string $eventName = null): object
105106
{
107+
if ($this->disabled?->__invoke()) {
108+
return $this->dispatcher->dispatch($event, $eventName);
109+
}
106110
$eventName ??= $event::class;
107111

108112
$this->callStack ??= new \SplObjectStorage();

0 commit comments

Comments
 (0)