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) {