src/Console/EventListener/ListenerInstantiator.php
public function instantiate(EventDispatcher $dispatcher, string $dirToSearchForListeners): void
    {
        $listeners = $this->searchListeners($dirToSearchForListeners);

        foreach ($listeners as $listener) {
            $r = new \ReflectionClass($listener);
            if ($r->implementsInterface('Symfony\\Component\\EventDispatcher\\EventSubscriberInterface')
                && !$r->isAbstract()
            ) {
                /** @var EventSubscriberInterface $listenerInstance */
                $listenerInstance = $r->newInstanceWithoutConstructor();
                $dispatcher->addSubscriber($listenerInstance);
            }
        }
    }
public function instantiate(EventDispatcher $dispatcher, string $dirToSearchForListeners): void
    {
        $listeners = $this->searchListeners($dirToSearchForListeners);

        foreach ($listeners as $listener) {
            $r = new \ReflectionClass($listener);
            if ($r->implementsInterface('Symfony\\Component\\EventDispatcher\\EventSubscriberInterface')
                && !$r->isAbstract()
            ) {
                /** @var EventSubscriberInterface $listenerInstance */
                $listenerInstance = $r->newInstanceWithoutConstructor();
                $dispatcher->addSubscriber($listenerInstance);
            }
        }
    }
Instantiate listeners in given directory and register them to given dispatcher