8000 [EventDispatcher] Fix unknown priority · symfony/symfony@9fb619a · GitHub
[go: up one dir, main page]

Skip to content

Commit 9fb619a

Browse files
committed
[EventDispatcher] Fix unknown priority
1 parent 47d26f6 commit 9fb619a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class WrappedListener
2929
private $dispatcher;
3030
private $pretty;
3131
private $stub;
32+
private $priority;
3233
private static $hasClassStub;
3334

3435
public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
@@ -96,19 +97,22 @@ public function getInfo($eventName)
9697

9798
return [
9899
'event' => $eventName,
99-
'priority' => null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : C810 null,
100+
'priority' => null !== $this->priority ? $this->priority : (null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null),
100101
'pretty' => $this->pretty,
101102
'stub' => $this->stub,
102103
];
103104
}
104105

105106
public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher)
106107
{
108+
$dispatcher = $this->dispatcher ?: $dispatcher;
109+
107110
$this->called = true;
111+
$this->priority = $dispatcher->getListenerPriority($eventName, $this->listener);
108112

109113
$e = $this->stopwatch->start($this->name, 'event_listener');
110114

111-
\call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher);
115+
\call_user_func($this->listener, $event, $eventName, $dispatcher);
112116

113117
if ($e->isStarted()) {
114118
$e->stop();

0 commit comments

Comments
 (0)
0