Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. File.php

function File::addError

Records an error against a specific token in the file.

Parameters

string $error The error message.:

int $stackPtr The stack position where the error occurred.:

string $code A violation code unique to the sniff message.:

array $data Replacements for the error message.:

int $severity The severity level for this error. A value of 0: will be converted into the default severity level.

boolean $fixable Can the error be fixed by the sniff?:

Return value

boolean

1 call to File::addError()
File::addFixableError in vendor/squizlabs/php_codesniffer/src/Files/File.php
Records a fixable error against a specific token in the file.

File

vendor/squizlabs/php_codesniffer/src/Files/File.php, line 685

Class

File

Namespace

PHP_CodeSniffer\Files

Code

public function addError($error, $stackPtr, $code, $data = [], $severity = 0, $fixable = false) {
    if ($stackPtr === null) {
        $line = 1;
        $column = 1;
    }
    else {
        $line = $this->tokens[$stackPtr]['line'];
        $column = $this->tokens[$stackPtr]['column'];
    }
    return $this->addMessage(true, $error, $line, $column, $code, $data, $severity, $fixable);
}
RSS feed
Powered by Drupal