Skip to content

Commit

Permalink
ContainerAwareEventManager: Fix typehint
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Oct 28, 2020
1 parent fae88d0 commit e085082
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Dbal/Events/ContainerAwareEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ final class ContainerAwareEventManager extends DoctrineEventManager
{
protected Container $container;

/** @var bool[][] */
/** @var bool[] */
protected array $initialized = [];

/** @var EventSubscriber[][] */
/** @var EventSubscriber[][]|mixed[][] */
protected array $listeners = [];


Expand All @@ -36,9 +36,8 @@ public function dispatchEvent($eventName, ?EventArgs $eventArgs = null): void
{
if (isset($this->listeners[$eventName])) {
$eventArgs = $eventArgs ?? EventArgs::getEmptyInstance();
$initialized = isset($this->initialized[$eventName]);
foreach ($this->listeners[$eventName] as $hash => $listener) {
if (!$initialized && !is_object($listener)) {
if (isset($this->initialized[$eventName]) === false) {
$this->listeners[$eventName][$hash] = $listener = $this->container->getService($listener);
}
$listener->$eventName($eventArgs);
Expand Down

0 comments on commit e085082

Please sign in to comment.