From 7a69a85c7ea5bdd1e875806a99c51a87d3a74b38 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Jan 2024 14:51:25 +0100 Subject: [PATCH] Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value --- Debug/TraceableEventDispatcher.php | 14 +++++++------- Debug/WrappedListener.php | 2 +- EventDispatcher.php | 6 +++--- EventDispatcherInterface.php | 4 ++-- ImmutableEventDispatcher.php | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Debug/TraceableEventDispatcher.php b/Debug/TraceableEventDispatcher.php index acfbf619..84d6a08a 100644 --- a/Debug/TraceableEventDispatcher.php +++ b/Debug/TraceableEventDispatcher.php @@ -42,7 +42,7 @@ class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterfa private $requestStack; private $currentRequestHash = ''; - public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null, RequestStack $requestStack = null) + public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, ?LoggerInterface $logger = null, ?RequestStack $requestStack = null) { $this->dispatcher = $dispatcher; $this->stopwatch = $stopwatch; @@ -97,7 +97,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function getListeners(string $eventName = null) + public function getListeners(?string $eventName = null) { return $this->dispatcher->getListeners($eventName); } @@ -123,7 +123,7 @@ public function getListenerPriority(string $eventName, $listener) /** * {@inheritdoc} */ - public function hasListeners(string $eventName = null) + public function hasListeners(?string $eventName = null) { return $this->dispatcher->hasListeners($eventName); } @@ -131,7 +131,7 @@ public function hasListeners(string $eventName = null) /** * {@inheritdoc} */ - public function dispatch(object $event, string $eventName = null): object + public function dispatch(object $event, ?string $eventName = null): object { $eventName = $eventName ?? \get_class($event); @@ -171,7 +171,7 @@ public function dispatch(object $event, string $eventName = null): object /** * @return array */ - public function getCalledListeners(Request $request = null) + public function getCalledListeners(?Request $request = null) { if (null === $this->callStack) { return []; @@ -192,7 +192,7 @@ public function getCalledListeners(Request $request = null) /** * @return array */ - public function getNotCalledListeners(Request $request = null) + public function getNotCalledListeners(?Request $request = null) { try { $allListeners = $this->getListeners(); @@ -235,7 +235,7 @@ public function getNotCalledListeners(Request $request = null) return $notCalled; } - public function getOrphanedEvents(Request $request = null): array + public function getOrphanedEvents(?Request $request = null): array { if ($request) { return $this->orphanedEvents[spl_object_hash($request)] ?? []; diff --git a/Debug/WrappedListener.php b/Debug/WrappedListener.php index 3c4cc133..80d49a16 100644 --- a/Debug/WrappedListener.php +++ b/Debug/WrappedListener.php @@ -33,7 +33,7 @@ final class WrappedListener private $priority; private static $hasClassStub; - public function __construct($listener, ?string $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null) + public function __construct($listener, ?string $name, Stopwatch $stopwatch, ?EventDispatcherInterface $dispatcher = null) { $this->listener = $listener; $this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? \Closure::fromCallable($listener) : null); diff --git a/EventDispatcher.php b/EventDispatcher.php index 8fe8fb5c..9c86bd95 100644 --- a/EventDispatcher.php +++ b/EventDispatcher.php @@ -45,7 +45,7 @@ public function __construct() /** * {@inheritdoc} */ - public function dispatch(object $event, string $eventName = null): object + public function dispatch(object $event, ?string $eventName = null): object { $eventName = $eventName ?? \get_class($event); @@ -65,7 +65,7 @@ public function dispatch(object $event, string $eventName = null): object /** * {@inheritdoc} */ - public function getListeners(string $eventName = null) + public function getListeners(?string $eventName = null) { if (null !== $eventName) { if (empty($this->listeners[$eventName])) { @@ -120,7 +120,7 @@ public function getListenerPriority(string $eventName, $listener) /** * {@inheritdoc} */ - public function hasListeners(string $eventName = null) + public function hasListeners(?string $eventName = null) { if (null !== $eventName) { return !empty($this->listeners[$eventName]); diff --git a/EventDispatcherInterface.php b/EventDispatcherInterface.php index cc324e1c..4b65e5a6 100644 --- a/EventDispatcherInterface.php +++ b/EventDispatcherInterface.php @@ -50,7 +50,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber); * * @return array */ - public function getListeners(string $eventName = null); + public function getListeners(?string $eventName = null); /** * Gets the listener priority for a specific event. @@ -66,5 +66,5 @@ public function getListenerPriority(string $eventName, callable $listener); * * @return bool */ - public function hasListeners(string $eventName = null); + public function hasListeners(?string $eventName = null); } diff --git a/ImmutableEventDispatcher.php b/ImmutableEventDispatcher.php index 568d79c3..4e00bfa4 100644 --- a/ImmutableEventDispatcher.php +++ b/ImmutableEventDispatcher.php @@ -28,7 +28,7 @@ public function __construct(EventDispatcherInterface $dispatcher) /** * {@inheritdoc} */ - public function dispatch(object $event, string $eventName = null): object + public function dispatch(object $event, ?string $eventName = null): object { return $this->dispatcher->dispatch($event, $eventName); } @@ -68,7 +68,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function getListeners(string $eventName = null) + public function getListeners(?string $eventName = null) { return $this->dispatcher->getListeners($eventName); } @@ -84,7 +84,7 @@ public function getListenerPriority(string $eventName, $listener) /** * {@inheritdoc} */ - public function hasListeners(string $eventName = null) + public function hasListeners(?string $eventName = null) { return $this->dispatcher->hasListeners($eventName); }