Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 284262a

Browse filesBrowse files
xabbuhfabpot
authored andcommitted
collect called listeners information only once
1 parent bde8204 commit 284262a
Copy full SHA for 284262a

File tree

1 file changed

+13
-13
lines changed
Filter options

1 file changed

+13
-13
lines changed

‎src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
+13-13Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,22 @@ public function getNotCalledListeners(/* Request $request = null */)
224224
}
225225

226226
$hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null;
227+
$calledListeners = [];
228+
229+
if (null !== $this->callStack) {
230+
foreach ($this->callStack as $calledListener) {
231+
list(, $requestHash) = $this->callStack->getInfo();
232+
233+
if (null === $hash || $hash === $requestHash) {
234+
$calledListeners[] = $calledListener->getWrappedListener();
235+
}
236+
}
237+
}
238+
227239
$notCalled = [];
228240
foreach ($allListeners as $eventName => $listeners) {
229241
foreach ($listeners as $listener) {
230-
$called = false;
231-
if (null !== $this->callStack) {
232-
foreach ($this->callStack as $calledListener) {
233-
list(, $requestHash) = $this->callStack->getInfo();
234-
if ((null === $hash || $hash === $requestHash) && $calledListener->getWrappedListener() === $listener) {
235-
$called = true;
236-
237-
break;
238-
}
239-
}
240-
}
241-
242-
if (!$called) {
242+
if (!\in_array($listener, $calledListeners, true)) {
243243
if (!$listener instanceof WrappedListener) {
244244
$listener = new WrappedListener($listener, null, $this->stopwatch, $this);
245245
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.