function VariableAnalysisSniff::searchForAndProcessClosingScopesAt
* Find scopes closed by a token and process their variables. * * Calls `processScopeClose()` for each closed scope. * *
Parameters
File $phpcsFile: * @param int $stackPtr * * @return void
1 call to VariableAnalysisSniff::searchForAndProcessClosingScopesAt()
- VariableAnalysisSniff::process in vendor/
sirbrillig/ phpcs-variable-analysis/ VariableAnalysis/ Sniffs/ CodeAnalysis/ VariableAnalysisSniff.php - * Scan and process a token. * * This is the main processing function of the sniff. Will run on every token * for which `register()` returns true. * *
File
-
vendor/
sirbrillig/ phpcs-variable-analysis/ VariableAnalysis/ Sniffs/ CodeAnalysis/ VariableAnalysisSniff.php, line 338
Class
Namespace
VariableAnalysis\Sniffs\CodeAnalysisCode
private function searchForAndProcessClosingScopesAt($phpcsFile, $stackPtr) {
$scopeIndicesThisCloses = $this->scopeManager
->getScopesForScopeEnd($phpcsFile->getFilename(), $stackPtr);
$tokens = $phpcsFile->getTokens();
$token = $tokens[$stackPtr];
$line = $token['line'];
foreach ($scopeIndicesThisCloses as $scopeIndexThisCloses) {
Helpers::debug('found closing scope at index', $stackPtr, 'line', $line, 'for scopes starting at:', $scopeIndexThisCloses->scopeStartIndex);
$this->processScopeClose($phpcsFile, $scopeIndexThisCloses->scopeStartIndex);
}
}