[EventDispatcher] Fix BC layer
This commit is contained in:
parent
cbbfe84154
commit
caa0aded89
@ -230,7 +230,20 @@ class EventDispatcher implements EventDispatcherInterface
|
||||
*/
|
||||
protected function callListeners(iterable $listeners, string $eventName, $event)
|
||||
{
|
||||
$this->doDispatch($listeners, $eventName, $event);
|
||||
if ($event instanceof Event) {
|
||||
$this->doDispatch($listeners, $eventName, $event);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$stoppable = $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;
|
||||
|
||||
foreach ($listeners as $listener) {
|
||||
if ($stoppable && $event->isPropagationStopped()) {
|
||||
break;
|
||||
}
|
||||
$listener($event, $eventName, $this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,10 +251,8 @@ class EventDispatcher implements EventDispatcherInterface
|
||||
*/
|
||||
protected function doDispatch($listeners, $eventName, Event $event)
|
||||
{
|
||||
$stoppable = $event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;
|
||||
|
||||
foreach ($listeners as $listener) {
|
||||
if ($stoppable && $event->isPropagationStopped()) {
|
||||
if ($event->isPropagationStopped()) {
|
||||
break;
|
||||
}
|
||||
$listener($event, $eventName, $this);
|
||||
|
Reference in New Issue
Block a user