public function Issue::addViolation in Drupal 7 to 8/9 Module Upgrader 8
Flags a single violation of this issue in a particular syntax node.
Parameters
\Pharborist\Node $node: The offending syntax tree node.
\Drupal\drupalmoduleupgrader\AnalyzerInterface $detector: The plugin which detected the violation.
Return value
$this
Overrides IssueInterface::addViolation
File
- src/
Issue.php, line 130
Class
Namespace
Drupal\drupalmoduleupgraderCode
public function addViolation(Node $node, AnalyzerInterface $detector) {
$file = $node
->getFilename();
if ($file) {
$this->violations[$file][] = [
'line_number' => $node
->getLineNumber(),
];
}
else {
throw new \DomainException('Cannot record an issue violation from a detached node.');
}
$this
->addDetector($detector);
return $this;
}