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
Namespace
VariableAnalysis\Sniffs\CodeAnalysisCode
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;
}