You are here

public function Drupal_Sniffs_Semantics_FunctionAliasSniff::processFunctionCall in Coder 7.2

Processes this function call.

Parameters

PHP_CodeSniffer_File $phpcsFile: The file being scanned.

int $stackPtr: The position of the function call in the stack.

int $openBracket: The position of the opening parenthesis in the stack.

int $closeBracket: The position of the closing parenthesis in the stack.

Drupal_Sniffs_Semantics_FunctionCallSniff $sniff: Can be used to retreive the function's arguments with the getArgument() method.

Return value

void

Overrides Drupal_Sniffs_Semantics_FunctionCall::processFunctionCall

File

coder_sniffer/Drupal/Sniffs/Semantics/FunctionAliasSniff.php, line 333

Class

Drupal_Sniffs_Semantics_FunctionAliasSniff
Checks that no PHP function name aliases are used.

Code

public function processFunctionCall(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $openBracket, $closeBracket, Drupal_Sniffs_Semantics_FunctionCallSniff $sniff) {
  $tokens = $phpcsFile
    ->getTokens();
  $error = '%s() is a function name alias, use %s() instead';
  $name = $tokens[$stackPtr]['content'];
  $data = array(
    $name,
    $this->aliases[$name],
  );
  $phpcsFile
    ->addError($error, $stackPtr, 'FunctionAlias', $data);
}