Webmozart\Console\Api\Config\ApplicationConfig::removeEventSubscriber PHP Method

removeEventSubscriber() public method

Removes an event subscriber from the dispatcher.
See also: EventDispatcherInterface::removeSubscriber()
public removeEventSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber ) : static
$subscriber Symfony\Component\EventDispatcher\EventSubscriberInterface The subscriber to remove.
return static The current instance.
    public function removeEventSubscriber(EventSubscriberInterface $subscriber)
    {
        if (!$this->dispatcher) {
            $this->dispatcher = new EventDispatcher();
        }
        $this->dispatcher->removeSubscriber($subscriber);
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 public function testRemoveEventSubscriber()
 {
     $dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $subscriber = $this->getMock('Symfony\\Component\\EventDispatcher\\EventSubscriberInterface');
     $dispatcher->expects($this->once())->method('removeSubscriber')->with($subscriber);
     $this->config->setEventDispatcher($dispatcher);
     $this->config->removeEventSubscriber($subscriber);
 }