function VariableAnalysisSniff::markVariableAssignment in Coder 8.2
Mark the given variable as being assigned.
Parameters
string $varName:
int $stackPtr:
string $currScope:
Return value
void
7 calls to VariableAnalysisSniff::markVariableAssignment()
- VariableAnalysisSniff::checkForAssignment in coder_sniffer/
DrupalPractice/ Sniffs/ CodeAnalysis/ VariableAnalysisSniff.php - Checks if the variable is being assigned to.
- VariableAnalysisSniff::checkForCatchBlock in coder_sniffer/
DrupalPractice/ Sniffs/ CodeAnalysis/ VariableAnalysisSniff.php - Checks if we are in a catch() block.
- 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::checkForListAssignment in coder_sniffer/
DrupalPractice/ Sniffs/ CodeAnalysis/ VariableAnalysisSniff.php - Check if this is a list language construct assignment.
File
- coder_sniffer/
DrupalPractice/ Sniffs/ CodeAnalysis/ VariableAnalysisSniff.php, line 761
Class
- VariableAnalysisSniff
- Checks the for undefined function variables.
Namespace
DrupalPractice\Sniffs\CodeAnalysisCode
function markVariableAssignment($varName, $stackPtr, $currScope) {
$varInfo = $this
->getVariableInfo($varName, $currScope);
if (isset($varInfo->scopeType) === false) {
$varInfo->scopeType = 'local';
}
if (isset($varInfo->firstInitialized) === true && $varInfo->firstInitialized <= $stackPtr) {
$varInfo->lastAssignment = $stackPtr;
return;
}
$varInfo->firstInitialized = $stackPtr;
}