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

Breadcrumb

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

function DeprecatedFunctionsSniff::addError

Generates the error or warning for this sniff.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:

int $stackPtr The position of the forbidden function: in the token array.

string $function The name of the forbidden function.:

string $pattern The pattern used for the match.:

Return value

void

Overrides ForbiddenFunctionsSniff::addError

File

vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php, line 60

Class

DeprecatedFunctionsSniff

Namespace

PHP_CodeSniffer\Standards\Generic\Sniffs\PHP

Code

protected function addError($phpcsFile, $stackPtr, $function, $pattern = null) {
    $data = [
        $function,
    ];
    $error = 'Function %s() has been deprecated';
    $type = 'Deprecated';
    if ($this->error === true) {
        $phpcsFile->addError($error, $stackPtr, $type, $data);
    }
    else {
        $phpcsFile->addWarning($error, $stackPtr, $type, $data);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal