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

removeEventListener() public method

Removes an event listener for the given event name.
See also: EventDispatcherInterface::removeListener()
public removeEventListener ( string $eventName, callable $listener ) : static
$eventName string The event name.
$listener callable The callback to remove.
return static The current instance.
    public function removeEventListener($eventName, $listener)
    {
        if (!$this->dispatcher) {
            $this->dispatcher = new EventDispatcher();
        }
        $this->dispatcher->removeListener($eventName, $listener);
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 public function testRemoveEventListener()
 {
     $dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $listener = function () {
     };
     $dispatcher->expects($this->once())->method('removeListener')->with('event-name', $listener);
     $this->config->setEventDispatcher($dispatcher);
     $this->config->removeEventListener('event-name', $listener);
 }