Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 5.4:
  Fix implicitly-required parameters
  List CS fix in .git-blame-ignore-revs
  Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
  [Messenger][AmazonSqs] Allow async-aws/sqs version 2
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents 4b4738c + 7a69a85 commit 6e344dd
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 @@ -43,7 +43,7 @@ class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterfa
private ?RequestStack $requestStack;
private string $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 @@ -93,7 +93,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
$this->dispatcher->removeSubscriber($subscriber);
}

public function getListeners(string $eventName = null): array
public function getListeners(?string $eventName = null): array
{
return $this->dispatcher->getListeners($eventName);
}
Expand All @@ -113,12 +113,12 @@ public function getListenerPriority(string $eventName, callable|array $listener)
return $this->dispatcher->getListenerPriority($eventName, $listener);
}

public function hasListeners(string $eventName = null): bool
public function hasListeners(?string $eventName = null): bool
{
return $this->dispatcher->hasListeners($eventName);
}

public function dispatch(object $event, string $eventName = null): object
public function dispatch(object $event, ?string $eventName = null): object
{
$eventName ??= $event::class;

Expand Down Expand Up @@ -153,7 +153,7 @@ public function dispatch(object $event, string $eventName = null): object
return $event;
}

public function getCalledListeners(Request $request = null): array
public function getCalledListeners(?Request $request = null): array
{
if (null === $this->callStack) {
return [];
Expand All @@ -171,7 +171,7 @@ public function getCalledListeners(Request $request = null): array
return $called;
}

public function getNotCalledListeners(Request $request = null): array
public function getNotCalledListeners(?Request $request = null): array
{
try {
$allListeners = $this->dispatcher instanceof EventDispatcher ? $this->getListenersWithPriority() : $this->getListenersWithoutPriority();
Expand Down Expand Up @@ -213,7 +213,7 @@ public function getNotCalledListeners(Request $request = null): array
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 @@ -34,7 +34,7 @@ final class WrappedListener
private ?int $priority = null;
private static bool $hasClassStub;

public function __construct(callable|array $listener, ?string $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null, int $priority = null)
public function __construct(callable|array $listener, ?string $name, Stopwatch $stopwatch, ?EventDispatcherInterface $dispatcher = null, ?int $priority = null)
{
$this->listener = $listener;
$this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? $listener(...) : null);
Expand Down
6 changes: 3 additions & 3 deletions EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct()
}
}

public function dispatch(object $event, string $eventName = null): object
public function dispatch(object $event, ?string $eventName = null): object
{
$eventName ??= $event::class;

Expand All @@ -59,7 +59,7 @@ public function dispatch(object $event, string $eventName = null): object
return $event;
}

public function getListeners(string $eventName = null): array
public function getListeners(?string $eventName = null): array
{
if (null !== $eventName) {
if (empty($this->listeners[$eventName])) {
Expand Down Expand Up @@ -108,7 +108,7 @@ public function getListenerPriority(string $eventName, callable|array $listener)
return null;
}

public function hasListeners(string $eventName = null): bool
public function hasListeners(?string $eventName = null): bool
{
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 @@ -59,7 +59,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber);
*
* @return array<callable[]|callable>
*/
public function getListeners(string $eventName = null): array;
public function getListeners(?string $eventName = null): array;

/**
* Gets the listener priority for a specific event.
Expand All @@ -71,5 +71,5 @@ public function getListenerPriority(string $eventName, callable $listener): ?int
/**
* Checks whether an event has any registered listeners.
*/
public function hasListeners(string $eventName = null): bool;
public function hasListeners(?string $eventName = null): bool;
}
6 changes: 3 additions & 3 deletions ImmutableEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(EventDispatcherInterface $dispatcher)
$this->dispatcher = $dispatcher;
}

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 @@ -62,7 +62,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
}

public function getListeners(string $eventName = null): array
public function getListeners(?string $eventName = null): array
{
return $this->dispatcher->getListeners($eventName);
}
Expand All @@ -72,7 +72,7 @@ public function getListenerPriority(string $eventName, callable|array $listener)
return $this->dispatcher->getListenerPriority($eventName, $listener);
}

public function hasListeners(string $eventName = null): bool
public function hasListeners(?string $eventName = null): bool
{
return $this->dispatcher->hasListeners($eventName);
}
Expand Down

0 comments on commit 6e344dd

Please sign in to comment.