public function Drupal_Sniffs_Semantics_FunctionDefinition::process in Coder 7.2
Processes this test, when one of its tokens is encountered.
Parameters
PHP_CodeSniffer_File $phpcsFile The file being scanned.:
int $stackPtr The position of the current token: in the stack passed in $tokens.
Return value
void
File
- coder_sniffer/
Drupal/ Sniffs/ Semantics/ FunctionDefinition.php, line 44
Class
- Drupal_Sniffs_Semantics_FunctionDefinition
- Helper class to sniff for function definitions.
Code
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile
->getTokens();
// Check if this is a function definition.
$functionPtr = $phpcsFile
->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr - 1, null, true);
if ($tokens[$functionPtr]['code'] === T_FUNCTION) {
$this
->processFunction($phpcsFile, $stackPtr, $functionPtr);
}
}