Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. VariableAnalysisSniff.php

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

VariableAnalysisSniff

Namespace

VariableAnalysis\Sniffs\CodeAnalysis

Code

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);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal