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

Breadcrumb

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

class VariableInfo

Holds details of a variable within a scope.

Hierarchy

  • class \VariableAnalysis\Lib\VariableInfo

Expanded class hierarchy of VariableInfo

2 files declare their use of VariableInfo
Helpers.php in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/Helpers.php
VariableAnalysisSniff.php in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php

File

vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/VariableInfo.php, line 10

Namespace

VariableAnalysis\Lib
View source
class VariableInfo {
    
    /**
     * @var string
     */
    public $name;
    
    /**
     * What scope the variable has: local, param, static, global, bound
     *
     * @var ScopeType::PARAM|ScopeType::BOUND|ScopeType::LOCAL|ScopeType::GLOBALSCOPE|ScopeType::STATICSCOPE|null
     */
    public $scopeType;
    
    /**
     * @var string|null
     */
    public $typeHint;
    
    /**
     * @var int|null
     */
    public $referencedVariableScope;
    
    /**
     * True if the variable is a reference but one created at runtime
     *
     * @var bool
     */
    public $isDynamicReference = false;
    
    /**
     * Stack pointer of first declaration
     *
     * Declaration is when a variable is created but has no value assigned.
     *
     * Assignment by reference is also a declaration and not an initialization.
     *
     * @var int|null
     */
    public $firstDeclared;
    
    /**
     * Stack pointer of first initialization
     *
     * @var int|null
     */
    public $firstInitialized;
    
    /**
     * Stack pointer of first read
     *
     * @var int|null
     */
    public $firstRead;
    
    /**
     * Stack pointers of all assignments
     *
     * This includes both declarations and initializations and may contain
     * duplicates!
     *
     * @var int[]
     */
    public $allAssignments = [];
    
    /**
     * @var bool
     */
    public $ignoreUnused = false;
    
    /**
     * @var bool
     */
    public $ignoreUndefined = false;
    
    /**
     * @var bool
     */
    public $isForeachLoopAssociativeValue = false;
    
    /**
     * @var array<ScopeType::PARAM|ScopeType::BOUND|ScopeType::LOCAL|ScopeType::GLOBALSCOPE|ScopeType::STATICSCOPE, string>
     */
    public static $scopeTypeDescriptions = [
        ScopeType::LOCAL => 'variable',
        ScopeType::PARAM => 'function parameter',
        ScopeType::STATICSCOPE => 'static variable',
        ScopeType::GLOBALSCOPE => 'global variable',
        ScopeType::BOUND => 'bound variable',
    ];
    
    /**
     * @param string $varName
     */
    public function __construct($varName) {
        $this->name = $varName;
    }

}

Members

Title Sort descending Modifiers Object type Summary
VariableInfo::$allAssignments public property * Stack pointers of all assignments
*
* This includes both declarations and initializations and may contain
* duplicates!
*
*
VariableInfo::$firstDeclared public property * Stack pointer of first declaration
*
* Declaration is when a variable is created but has no value assigned.
*
* Assignment by reference is also a declaration and not an initialization.
*
*
VariableInfo::$firstInitialized public property * Stack pointer of first initialization
*
*
VariableInfo::$firstRead public property * Stack pointer of first read
*
*
VariableInfo::$ignoreUndefined public property *
VariableInfo::$ignoreUnused public property *
VariableInfo::$isDynamicReference public property * True if the variable is a reference but one created at runtime
*
*
VariableInfo::$isForeachLoopAssociativeValue public property *
VariableInfo::$name public property *
VariableInfo::$referencedVariableScope public property *
VariableInfo::$scopeType public property * What scope the variable has: local, param, static, global, bound
*
*
VariableInfo::$scopeTypeDescriptions public static property *
VariableInfo::$typeHint public property *
VariableInfo::__construct public function *

API Navigation

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