This commit is contained in:
Paolo A
2024-08-13 13:44:16 +00:00
parent 1bbb23088d
commit e796d76612
4001 changed files with 30101 additions and 40075 deletions

View File

@@ -18,23 +18,20 @@ namespace Symfony\Component\EventDispatcher;
*/
class ImmutableEventDispatcher implements EventDispatcherInterface
{
private $dispatcher;
private EventDispatcherInterface $dispatcher;
public function __construct(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $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);
}
/**
* {@inheritdoc}
* @return never
*/
public function addListener(string $eventName, callable|array $listener, int $priority = 0)
{
@@ -42,7 +39,7 @@ class ImmutableEventDispatcher implements EventDispatcherInterface
}
/**
* {@inheritdoc}
* @return never
*/
public function addSubscriber(EventSubscriberInterface $subscriber)
{
@@ -50,7 +47,7 @@ class ImmutableEventDispatcher implements EventDispatcherInterface
}
/**
* {@inheritdoc}
* @return never
*/
public function removeListener(string $eventName, callable|array $listener)
{
@@ -58,33 +55,24 @@ class ImmutableEventDispatcher implements EventDispatcherInterface
}
/**
* {@inheritdoc}
* @return never
*/
public function removeSubscriber(EventSubscriberInterface $subscriber)
{
throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
}
/**
* {@inheritdoc}
*/
public function getListeners(string $eventName = null): array
public function getListeners(?string $eventName = null): array
{
return $this->dispatcher->getListeners($eventName);
}
/**
* {@inheritdoc}
*/
public function getListenerPriority(string $eventName, callable|array $listener): ?int
{
return $this->dispatcher->getListenerPriority($eventName, $listener);
}
/**
* {@inheritdoc}
*/
public function hasListeners(string $eventName = null): bool
public function hasListeners(?string $eventName = null): bool
{
return $this->dispatcher->hasListeners($eventName);
}