From d96aec90b708d12528ac3048096d8d46682b5596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 23 Jun 2022 00:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EventDispatch.php | 3 ++- EventProvider.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/EventDispatch.php b/EventDispatch.php index 9dbf985..0ec8a9f 100644 --- a/EventDispatch.php +++ b/EventDispatch.php @@ -43,7 +43,8 @@ class EventDispatch extends Component implements EventDispatcherInterface $lists->top(); while ($lists->valid()) { try { - call_user_func($lists->current(), $event); + $current = $lists->current(); + call_user_func($current, $event); } catch (\Throwable $exception) { $this->logger->error($exception->getMessage(), [$exception]); } diff --git a/EventProvider.php b/EventProvider.php index 257665d..659800d 100644 --- a/EventProvider.php +++ b/EventProvider.php @@ -23,7 +23,7 @@ class EventProvider implements ListenerProviderInterface public function getListenersForEvent(object $event): SplPriorityQueue { $queue = new SplPriorityQueue(); - $queue->setExtractFlags(SplPriorityQueue::EXTR_BOTH); + $queue->setExtractFlags(SplPriorityQueue::EXTR_DATA); // TODO: Implement getListenersForEvent() method. foreach ($this->_listeners[get_class($event)] ?? [] as $listener) { $queue->insert($listener->listener, $listener->priority);