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
Namespace
PHP_CodeSniffer\Standards\Generic\Sniffs\PHPCode
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);
}
}