Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit f1ad8bc

Browse files
committed
feat: prefer isPropagationStopped over propagationIsStopped
If the method `isPropagationStopped()` is defined, use it over the `propagationIsStopped()` method.
1 parent 99c6446 commit f1ad8bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/EventManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ protected function triggerListeners(EventInterface $event, callable $callback =
314314
// Initial value of stop propagation flag should be false
315315
$event->stopPropagation(false);
316316

317+
$stopMethod = $event instanceof StoppableEventInterface ? 'isPropagationStopped' : 'propagationIsStopped';
318+
317319
// Execute listeners
318320
$responses = new ResponseCollection();
319321
foreach ($listOfListenersByPriority as $listOfListeners) {
@@ -323,7 +325,7 @@ protected function triggerListeners(EventInterface $event, callable $callback =
323325
$responses->push($response);
324326

325327
// If the event was asked to stop propagating, do so
326-
if ($event->propagationIsStopped()) {
328+
if ($event->{$stopMethod}()) {
327329
$responses->setStopped(true);
328330
return $responses;
329331
}

0 commit comments

Comments
 (0)