protected function matches($other): bool
    {
        $this->resetProblems();
        if (!($other instanceof EventSubscriberInterface)) {
            $this->addProblem('Subscriber must implement \Symfony\Component\EventDispatcher\EventSubscriberInterface.');
            return false;
        }
        $subscribedEvents = call_user_func(array(get_class($other), 'getSubscribedEvents'));
        if (!is_array($subscribedEvents)) {
            $this->addProblem('getSubscribedEvents() must return an array.');
            return false;
        }
        foreach ($subscribedEvents as $event => $subscription) {
            /* @var $event string */
            /* @var $subscription mixed|string|array */
            $this->checkListener($other, $event, $subscription);
        }
        return !$this->hasProblems();
    }