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

Breadcrumb

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

function VariableAnalysisSniff::getVariableInfo

*

Parameters

string $varName: * @param int $currScope * * @return VariableInfo|null

1 call to VariableAnalysisSniff::getVariableInfo()
VariableAnalysisSniff::markVariableAssignmentWithoutInitialization in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
* Record that a variable has been assigned a value. * * Does not record that a variable has been defined, which is the usual state * of affairs. For that, use `markVariableAssignment()`. * * This is useful for assignments to references. * *

File

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

Class

VariableAnalysisSniff

Namespace

VariableAnalysis\Sniffs\CodeAnalysis

Code

protected function getVariableInfo($varName, $currScope) {
    $scopeInfo = $this->scopeManager
        ->getScopeForScopeStart($this->getFilename(), $currScope);
    return $scopeInfo && isset($scopeInfo->variables[$varName]) ? $scopeInfo->variables[$varName] : null;
}

API Navigation

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