public function FunctionCall::process in Coder 8.3.x
Same name and namespace in other branches
- 8.3 coder_sniffer/Drupal/Sniffs/Semantics/FunctionCall.php \Drupal\Sniffs\Semantics\FunctionCall::process()
- 8.2 coder_sniffer/Drupal/Sniffs/Semantics/FunctionCall.php \Drupal\Sniffs\Semantics\FunctionCall::process()
Processes this test, when one of its tokens is encountered.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:
int $stackPtr The position of the current token: in the stack passed in $tokens.
Return value
void
2 methods override FunctionCall::process()
- GlobalFunctionSniff::process in coder_sniffer/
DrupalPractice/ Sniffs/ Objects/ GlobalFunctionSniff.php - Processes this test, when one of its tokens is encountered.
- ThemeSniff::process in coder_sniffer/
DrupalPractice/ Sniffs/ FunctionCalls/ ThemeSniff.php - Processes this function call.
File
- coder_sniffer/
Drupal/ Sniffs/ Semantics/ FunctionCall.php, line 91
Class
- FunctionCall
- Helper class to sniff for specific function calls.
Namespace
Drupal\Sniffs\SemanticsCode
public function process(File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile
->getTokens();
$functionName = $tokens[$stackPtr]['content'];
if (in_array($functionName, $this
->registerFunctionNames()) === false) {
// Not interested in this function.
return;
}
if ($this
->isFunctionCall($phpcsFile, $stackPtr) === false) {
return;
}
// Find the next non-empty token.
$openBracket = $phpcsFile
->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true);
$this->phpcsFile = $phpcsFile;
$this->functionCall = $stackPtr;
$this->openBracket = $openBracket;
$this->closeBracket = $tokens[$openBracket]['parenthesis_closer'];
$this->arguments = [];
$this
->processFunctionCall($phpcsFile, $stackPtr, $openBracket, $this->closeBracket);
}