function AbstractScopeSniff::process
Processes the tokens that this test is listening for.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.:
int $stackPtr The position in the stack where this: token was found.
Return value
void|int Optionally returns a stack pointer. The sniff will not be called again on the current file until the returned stack pointer is reached. Return `$phpcsFile->numTokens` to skip the rest of the file.
Overrides Sniff::process
See also
processTokenWithinScope()
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Sniffs/ AbstractScopeSniff.php, line 130
Class
Namespace
PHP_CodeSniffer\SniffsCode
public final function process(File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile->getTokens();
$foundScope = false;
$skipTokens = [];
foreach ($tokens[$stackPtr]['conditions'] as $scope => $code) {
if (isset($this->scopeTokens[$code]) === true) {
$skipTokens[] = $this->processTokenWithinScope($phpcsFile, $stackPtr, $scope);
$foundScope = true;
}
}
if ($this->listenOutside === true && $foundScope === false) {
$skipTokens[] = $this->processTokenOutsideScope($phpcsFile, $stackPtr);
}
if (empty($skipTokens) === false) {
return min($skipTokens);
}
}