From 214fac18875d4f0899bbd1149aeabf7a0094a48d Mon Sep 17 00:00:00 2001 From: Rafal Purwin Date: Mon, 29 Jan 2024 11:07:41 +0100 Subject: [PATCH] compatibility update of Dispatcher with EventDispatcherInterface from Symfony7 --- src/Event/Dispatcher.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Event/Dispatcher.php b/src/Event/Dispatcher.php index 3b482ab..1da62a3 100644 --- a/src/Event/Dispatcher.php +++ b/src/Event/Dispatcher.php @@ -38,7 +38,7 @@ public function dispatch(object $event, string $eventName = null): object /** * {@inheritdoc} */ - public function addListener(string $eventName, $listener, int $priority = 0) + public function addListener(string $eventName, callable $listener, int $priority = 0): void { throw new \Exception('Please use `Event::listen()`.'); } @@ -46,7 +46,7 @@ public function addListener(string $eventName, $listener, int $priority = 0) /** * {@inheritdoc} */ - public function addSubscriber(EventSubscriberInterface $subscriber) + public function addSubscriber(EventSubscriberInterface $subscriber): void { throw new \Exception('Please use `Event::subscribe()`.'); } @@ -54,7 +54,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function removeListener(string $eventName, $listener) + public function removeListener(string $eventName, callable $listener): void { throw new \Exception('Please use `Event::forget()`.'); } @@ -62,7 +62,7 @@ public function removeListener(string $eventName, $listener) /** * {@inheritdoc} */ - public function removeSubscriber(EventSubscriberInterface $subscriber) + public function removeSubscriber(EventSubscriberInterface $subscriber): void { throw new \Exception('Removing event subscribers is not supported'); }