You are here

function VariableAnalysisSniff::isVariableInitialized in Coder 8.2

Checks if a variable has been initialized.

Parameters

string $varName:

int $stackPtr:

string $currScope:

Return value

bool

File

coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php, line 864

Class

VariableAnalysisSniff
Checks the for undefined function variables.

Namespace

DrupalPractice\Sniffs\CodeAnalysis

Code

function isVariableInitialized($varName, $stackPtr, $currScope) {
  $varInfo = $this
    ->getVariableInfo($varName, $currScope);
  if (isset($varInfo->firstInitialized) === true && $varInfo->firstInitialized <= $stackPtr) {
    return true;
  }
  return false;
}