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

Breadcrumb

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

function VariableAnalysisSniff::getOrCreateScopeInfo

*

Parameters

int $currScope: * * @return ScopeInfo

3 calls to VariableAnalysisSniff::getOrCreateScopeInfo()
VariableAnalysisSniff::getOrCreateVariableInfo in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
* Returns variable data for a variable at an index. * * The variable will also be added to the list of variables stored in its * scope so that its use or non-use can be reported when those scopes end by * `processScopeClose()`. * *
VariableAnalysisSniff::markAllVariablesRead in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
* Mark all variables within a scope as being used. * * This will prevent any of the variables in that scope from being reported * as unused. * *
VariableAnalysisSniff::processVariableAsAssignment in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
* Process a variable that is being assigned. * * This will record that the variable has been defined within a scope so that * later we can determine if it it unused and we can guarantee that any * future uses of the variable are not using an…

File

vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php, line 412

Class

VariableAnalysisSniff

Namespace

VariableAnalysis\Sniffs\CodeAnalysis

Code

protected function getOrCreateScopeInfo($currScope) {
    $scope = $this->scopeManager
        ->getScopeForScopeStart($this->getFilename(), $currScope);
    if (!$scope) {
        if (!$this->currentFile) {
            throw new \Exception('Cannot create scope info; current file is not set.');
        }
        $scope = $this->scopeManager
            ->recordScopeStartAndEnd($this->currentFile, $currScope);
    }
    return $scope;
}

API Navigation

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