Skip to content

Commit 7a69a85

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent e3bca34 commit 7a69a85

5 files changed

+16
-16
lines changed

Debug/TraceableEventDispatcher.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterfa
4242
private $requestStack;
4343
private $currentRequestHash = '';
4444

45-
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null, RequestStack $requestStack = null)
45+
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, ?LoggerInterface $logger = null, ?RequestStack $requestStack = null)
4646
{
4747
$this->dispatcher = $dispatcher;
4848
$this->stopwatch = $stopwatch;
@@ -97,7 +97,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
9797
/**
9898
* {@inheritdoc}
9999
*/
100-
public function getListeners(string $eventName = null)
100+
public function getListeners(?string $eventName = null)
101101
{
102102
return $this->dispatcher->getListeners($eventName);
103103
}
@@ -123,15 +123,15 @@ public function getListenerPriority(string $eventName, $listener)
123123
/**
124124
* {@inheritdoc}
125125
*/
126-
public function hasListeners(string $eventName = null)
126+
public function hasListeners(?string $eventName = null)
127127
{
128128
return $this->dispatcher->hasListeners($eventName);
129129
}
130130

131131
/**
132132
* {@inheritdoc}
133133
*/
134-
public function dispatch(object $event, string $eventName = null): object
134+
public function dispatch(object $event, ?string $eventName = null): object
135135
{
136136
$eventName = $eventName ?? \get_class($event);
137137

@@ -171,7 +171,7 @@ public function dispatch(object $event, string $eventName = null): object
171171
/**
172172
* @return array
173173
*/
174-
public function getCalledListeners(Request $request = null)
174+
public function getCalledListeners(?Request $request = null)
175175
{
176176
if (null === $this->callStack) {
177177
return [];
@@ -192,7 +192,7 @@ public function getCalledListeners(Request $request = null)
192192
/**
193193
* @return array
194194
*/
195-
public function getNotCalledListeners(Request $request = null)
195+
public function getNotCalledListeners(?Request $request = null)
196196
{
197197
try {
198198
$allListeners = $this->getListeners();
@@ -235,7 +235,7 @@ public function getNotCalledListeners(Request $request = null)
235235
return $notCalled;
236236
}
237237

238-
public function getOrphanedEvents(Request $request = null): array
238+
public function getOrphanedEvents(?Request $request = null): array
239239
{
240240
if ($request) {
241241
return $this->orphanedEvents[spl_object_hash($request)] ?? [];

Debug/WrappedListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class WrappedListener
3333
private $priority;
3434
private static $hasClassStub;
3535

36-
public function __construct($listener, ?string $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
36+
public function __construct($listener, ?string $name, Stopwatch $stopwatch, ?EventDispatcherInterface $dispatcher = null)
3737
{
3838
$this->listener = $listener;
3939
$this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? \Closure::fromCallable($listener) : null);

EventDispatcher.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct()
4545
/**
4646
* {@inheritdoc}
4747
*/
48-
public function dispatch(object $event, string $eventName = null): object
48+
public function dispatch(object $event, ?string $eventName = null): object
4949
{
5050
$eventName = $eventName ?? \get_class($event);
5151

@@ -65,7 +65,7 @@ public function dispatch(object $event, string $eventName = null): object
6565
/**
6666
* {@inheritdoc}
6767
*/
68-
public function getListeners(string $eventName = null)
68+
public function getListeners(?string $eventName = null)
6969
{
7070
if (null !== $eventName) {
7171
if (empty($this->listeners[$eventName])) {
@@ -120,7 +120,7 @@ public function getListenerPriority(string $eventName, $listener)
120120
/**
121121
* {@inheritdoc}
122122
*/
123-
public function hasListeners(string $eventName = null)
123+
public function hasListeners(?string $eventName = null)
124124
{
125125
if (null !== $eventName) {
126126
return !empty($this->listeners[$eventName]);

EventDispatcherInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber);
5050
*
5151
* @return array<callable[]|callable>
5252
*/
53-
public function getListeners(string $eventName = null);
53+
public function getListeners(?string $eventName = null);
5454

5555
/**
5656
* Gets the listener priority for a specific event.
@@ -66,5 +66,5 @@ public function getListenerPriority(string $eventName, callable $listener);
6666
*
6767
* @return bool
6868
*/
69-
public function hasListeners(string $eventName = null);
69+
public function hasListeners(?string $eventName = null);
7070
}

ImmutableEventDispatcher.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(EventDispatcherInterface $dispatcher)
2828
/**
2929
* {@inheritdoc}
3030
*/
31-
public function dispatch(object $event, string $eventName = null): object
31+
public function dispatch(object $event, ?string $eventName = null): object
3232
{
3333
return $this->dispatcher->dispatch($event, $eventName);
3434
}
@@ -68,7 +68,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
6868
/**
6969
* {@inheritdoc}
7070
*/
71-
public function getListeners(string $eventName = null)
71+
public function getListeners(?string $eventName = null)
7272
{
7373
return $this->dispatcher->getListeners($eventName);
7474
}
@@ -84,7 +84,7 @@ public function getListenerPriority(string $eventName, $listener)
8484
/**
8585
* {@inheritdoc}
8686
*/
87-
public function hasListeners(string $eventName = null)
87+
public function hasListeners(?string $eventName = null)
8888
{
8989
return $this->dispatcher->hasListeners($eventName);
9090
}

0 commit comments

Comments
 (0)