Flitch\Rule\AbstractRule::addViolation PHP Method

addViolation() protected method

Add a violation to the current file.
protected addViolation ( File $file, integer $line, integer $column, string $message, integer | null $severity = null ) : void
$file Flitch\File\File
$line integer
$column integer
$message string
$severity integer | null
return void
    protected function addViolation(File $file, $line, $column, $message, $severity = null)
    {
        $source = get_class($this);
        if (strpos($source, 'Flitch\\Rule\\') === 0) {
            $source = 'Flitch\\' . substr($source, strlen('Flitch\\Rule\\'));
        }
        if ($severity === null) {
            $severity = $this->severity;
        }
        $file->addViolation(new Violation($line, $column, $severity, $message, $source));
    }