public function Drupal_Sniffs_ControlStructures_InlineControlStructureSniff::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/ ControlStructures/ InlineControlStructureSniff.php, line 37
Class
- Drupal_Sniffs_ControlStructures_InlineControlStructureSniff
- Drupal_Sniffs_ControlStructures_InlineControlStructureSniff.
Code
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile
->getTokens();
// Check for the alternate syntax for control structures with colons (:).
if (isset($tokens[$stackPtr]['parenthesis_closer'])) {
$start = $tokens[$stackPtr]['parenthesis_closer'];
}
else {
$start = $stackPtr;
}
$scopeOpener = $phpcsFile
->findNext(T_WHITESPACE, $start + 1, null, true);
if ($tokens[$scopeOpener]['code'] === T_COLON) {
return;
}
parent::process($phpcsFile, $stackPtr);
}