Skip to content

Commit

Permalink
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_…
Browse files Browse the repository at this point in the history
…null_value
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
1 parent e3bca34 commit 7a69a85
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions Debug/TraceableEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -123,15 +123,15 @@ public function getListenerPriority(string $eventName, $listener)
/**
* {@inheritdoc}
*/
public function hasListeners(string $eventName = null)
public function hasListeners(?string $eventName = null)
{
return $this->dispatcher->hasListeners($eventName);
}

/**
* {@inheritdoc}
*/
public function dispatch(object $event, string $eventName = null): object
public function dispatch(object $event, ?string $eventName = null): object
{
$eventName = $eventName ?? \get_class($event);

Expand Down Expand Up @@ -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 [];
Expand All @@ -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();
Expand Down Expand Up @@ -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)] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion Debug/WrappedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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])) {
Expand Down Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions EventDispatcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber);
*
* @return array<callable[]|callable>
*/
public function getListeners(string $eventName = null);
public function getListeners(?string $eventName = null);

/**
* Gets the listener priority for a specific event.
Expand All @@ -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);
}
6 changes: 3 additions & 3 deletions ImmutableEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 7a69a85

Please sign in to comment.