From 7cc6c66bab7aaf9aafbc010063351a1a63892cfa Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 28 Nov 2024 14:19:42 +1300 Subject: [PATCH] API Explicity mark nullable parameters for PHP 8.4 --- src/Dispatch/EventDispatcherInterface.php | 2 +- src/Symfony/Event.php | 2 +- tests/Dispatch/MockBackend.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dispatch/EventDispatcherInterface.php b/src/Dispatch/EventDispatcherInterface.php index a9a962d..d6bb146 100644 --- a/src/Dispatch/EventDispatcherInterface.php +++ b/src/Dispatch/EventDispatcherInterface.php @@ -25,5 +25,5 @@ public function removeListener(string $eventName, EventHandlerInterface $listene * @param object $eventContext * @param string|null $eventName */ - public function dispatch(object $eventContext, string $eventName = null): void; + public function dispatch(object $eventContext, ?string $eventName = null): void; } diff --git a/src/Symfony/Event.php b/src/Symfony/Event.php index 5b9328a..fb6401a 100644 --- a/src/Symfony/Event.php +++ b/src/Symfony/Event.php @@ -20,7 +20,7 @@ class Event implements EventContextInterface * @param string $action * @param array $properties */ - public function __construct(string $action = null, array $properties = []) + public function __construct(?string $action = null, array $properties = []) { $this->event = new GenericEvent($action, $properties); } diff --git a/tests/Dispatch/MockBackend.php b/tests/Dispatch/MockBackend.php index b7d0d5a..f4bfe22 100644 --- a/tests/Dispatch/MockBackend.php +++ b/tests/Dispatch/MockBackend.php @@ -11,7 +11,7 @@ class MockBackend implements EventDispatcherInterface public $listeners = []; - public function dispatch(object $eventContext, string $eventName = null): void + public function dispatch(object $eventContext, ?string $eventName = null): void { $listeners = $this->listeners[$eventName] ?? []; foreach ($listeners as $listener) {