You are here

function VariableAnalysisSniff::markVariableRead in Coder 8.2

Mark the given variable as being read.

Parameters

string $varName:

int $stackPtr:

string $currScope:

Return value

void

4 calls to VariableAnalysisSniff::markVariableRead()
VariableAnalysisSniff::checkForForeachLoopVar in coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
Check if this is a foreach loop variable.
VariableAnalysisSniff::checkForFunctionPrototype in coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
Checks the function prototype.
VariableAnalysisSniff::checkForPassByReferenceFunctionCall in coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
Check if this is a "&" function call.
VariableAnalysisSniff::markVariableReadAndWarnIfUndefined in coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
Marks a variable as read and throws a PHPCS warning if it is undefined.

File

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

Class

VariableAnalysisSniff
Checks the for undefined function variables.

Namespace

DrupalPractice\Sniffs\CodeAnalysis

Code

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