protected function checkListener(EventSubscriberInterface $subscriber, $event, $listener)
    {
        if (is_string($listener)) {
            // Add the default priority and use the default validation.
            $listener = array($listener, 0);
        }
        if (!is_array($listener)) {
            $this->addProblem(sprintf('Listener definition for event "%s" must be an array or a string.', $event));
            return;
        }
        if ($this->containsSeveralSubscriptions($listener)) {
            foreach ($listener as $subListener) {
                $this->checkListener($subscriber, $event, $subListener);
            }
            return;
        }
        if (count($listener) === 1) {
            // Method without priority.
            $listener[] = 0;
        }

        if (count($listener) !== 2) {
            $message = 'Listener definition for event "%s" must consist of a method and a priority, but received: %s';
            $this->addProblem(sprintf($message, $event, $this->exporter->export($listener)));
            return;
        }
        list($method, $priority) = $listener;
        $this->checkMethod($subscriber, $event, $method);
        $this->checkPriority($event, $priority);
    }
protected function checkListener(EventSubscriberInterface $subscriber, $event, $listener)
    {
        if (is_string($listener)) {
            // Add the default priority and use the default validation.
            $listener = array($listener, 0);
        }
        if (!is_array($listener)) {
            $this->addProblem(sprintf('Listener definition for event "%s" must be an array or a string.', $event));
            return;
        }
        if ($this->containsSeveralSubscriptions($listener)) {
            foreach ($listener as $subListener) {
                $this->checkListener($subscriber, $event, $subListener);
            }
            return;
        }
        if (count($listener) === 1) {
            // Method without priority.
            $listener[] = 0;
        }

        if (count($listener) !== 2) {
            $message = 'Listener definition for event "%s" must consist of a method and a priority, but received: %s';
            $this->addProblem(sprintf($message, $event, $this->exporter->export($listener)));
            return;
        }
        list($method, $priority) = $listener;
        $this->checkMethod($subscriber, $event, $method);
        $this->checkPriority($event, $priority);
    }
protected function checkListener ( EventSubscriberInterface $ subscriber , $ event , $ listener ) { if ( is_string ( $ listener ) ) { // Add the default priority and use the default validation. $ listener = array ( $ listener , 0 ) ; } if ( ! is_array ( $ listener ) ) { $ this -> addProblem ( sprintf ( 'Listener definition for event "%s" must be an array or a string.' , $ event ) ) ; return ; } if ( $ this -> containsSeveralSubscriptions ( $ listener ) ) { foreach ( $ listener as $ subListener ) { $ this -> checkListener ( $ subscriber , $ event , $ subListener ) ; } return ; } if ( count ( $ listener ) === 1 ) { // Method without priority. $ listener [ ] = 0 ; } if ( count ( $ listener ) !== 2 ) { $ message = 'Listener definition for event "%s" must consist of a method and a priority, but received: %s' ; $ this -> addProblem ( sprintf ( $ message , $ event , $ this -> exporter -> export ( $ listener ) ) ) ; return ; } list ( $ method , $ priority ) = $ listener ; $ this -> checkMethod ( $ subscriber , $ event , $ method ) ; $ this -> checkPriority ( $ event , $ priority ) ; }
Checks if the listener definition for the given event is valid.

@param EventSubscriberInterface $subscriber
@param string $event
@param mixed $listener
Checks if the listener definition for the given event is valid .