/** * {@inheritdoc} */ protected function outputNodeChecked(NodeChecked $event) { $key = $event->getNode()->getFilepath(); if (null !== $event->getViolation() && !in_array($key, $this->nodesOnError)) { $this->nodesOnError[] = $key; } }
/** * @param NodeChecked $event */ public function nodeChecked(NodeChecked $event) { ++$this->checkingNodeIteration; $key = $event->getNode()->getFilepath(); if (null !== $event->getViolation() && !in_array($key, $this->nodesOnError)) { $this->nodesOnError[] = $key; } $this->outputNodeChecked($event); }
/** * {@inheritdoc} */ protected function outputNodeChecked(NodeChecked $event) { if (null === $event->getViolation()) { return; } $rule = $event->getRule(); $node = $event->getNode(); $violation = $event->getViolation(); $errorType = RuleInterface::TYPE_DISCOURAGED === $rule->getType() ? 'warning' : 'error'; $msg = !$this->verbose ? sprintf('Node <comment>%s</comment> does not respect the rule <comment>%s</comment> because of the tokens:', $node->getFilepath(), $rule->getSubject()) : sprintf(<<<MSG Node <comment>%s</comment> does not respect the rule <comment>%s</comment>: * type: %s * description: %s * requirements: %s The following tokens are wrong: MSG , $node->getFilepath(), $rule->getSubject(), $rule->getType(), $rule->getDescription() ?: 'N/A', implode(', ', $rule->getRequirements())); $this->output->writeln(''); $this->output->writeln($msg); foreach ($violation->getTokenViolations() as $token) { $this->output->writeln(sprintf(' * <%s>%s</%s>', $errorType, $token, $errorType)); } }