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

Breadcrumb

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

function VariableAnalysisSniff::markAllVariablesRead

* Mark all variables within a scope as being used. * * This will prevent any of the variables in that scope from being reported * as unused. * *

Parameters

File $phpcsFile: * @param int $stackPtr * * @return void

1 call to VariableAnalysisSniff::markAllVariablesRead()
VariableAnalysisSniff::process in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
* Scan and process a token. * * This is the main processing function of the sniff. Will run on every token * for which `register()` returns true. * *

File

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

Class

VariableAnalysisSniff

Namespace

VariableAnalysis\Sniffs\CodeAnalysis

Code

protected function markAllVariablesRead(File $phpcsFile, $stackPtr) {
    $currScope = Helpers::findVariableScope($phpcsFile, $stackPtr);
    if ($currScope === null) {
        return;
    }
    $scopeInfo = $this->getOrCreateScopeInfo($currScope);
    $count = count($scopeInfo->variables);
    Helpers::debug("marking all {$count} variables in scope as read");
    foreach ($scopeInfo->variables as $varInfo) {
        $this->markVariableRead($varInfo->name, $stackPtr, $scopeInfo->scopeStartIndex);
    }
}

API Navigation

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