src/EventsTrait.php
public function disableEventListener(string $event, $subscriberClass)
    {
        $subscriberClass = $this->getSubscriberClassName($subscriberClass);

        if (!\array_key_exists($event, $this->disabledListeners)) {
            $this->disabledListeners[$event] = [];
        }

        $eventManager = $this->getEventManager();

        foreach ($this->getEventListeners($event) as $listener) {
            if ($listener instanceof $subscriberClass) {
                $this->disabledListeners[$event][] = $listener;

                $eventManager->removeEventListener($event, $listener);
                break;
            }
        }
    }
public function disableEventListener(string $event, $subscriberClass)
    {
        $subscriberClass = $this->getSubscriberClassName($subscriberClass);

        if (!\array_key_exists($event, $this->disabledListeners)) {
            $this->disabledListeners[$event] = [];
        }

        $eventManager = $this->getEventManager();

        foreach ($this->getEventListeners($event) as $listener) {
            if ($listener instanceof $subscriberClass) {
                $this->disabledListeners[$event][] = $listener;

                $eventManager->removeEventListener($event, $listener);
                break;
            }
        }
    }
Disable listener for an event.

@param string                 $event
@param string|EventSubscriber $subscriberClass

@throws \InvalidArgumentException