function FunctionDefinition::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
Overrides Sniff::process
File
-
vendor/
drupal/ coder/ coder_sniffer/ Drupal/ Sniffs/ Semantics/ FunctionDefinition.php, line 48
Class
- FunctionDefinition
- Helper class to sniff for function definitions.
Namespace
Drupal\Sniffs\SemanticsCode
public function process(File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile->getTokens();
// Check if this is a function definition.
$functionPtr = $phpcsFile->findPrevious(Tokens::$emptyTokens, $stackPtr - 1, null, true);
if ($tokens[$functionPtr]['code'] === T_FUNCTION) {
$this->processFunction($phpcsFile, $stackPtr, $functionPtr);
}
}