• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sirbrillig / phpcs-variable-analysis / 15122323241

19 May 2025 08:15PM UTC coverage: 93.79%. Remained the same
15122323241

push

github

web-flow
Ruleset: update schema URL (#353)

PHPCS now offers permalinks for the schema.

Refs:
* PHPCSStandards/PHP_CodeSniffer 1094
* https://github.com/PHPCSStandards/schema.phpcodesniffer.com

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>

1903 of 2029 relevant lines covered (93.79%)

138.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/VariableAnalysis/Lib/VariableInfo.php
1
<?php
2

3
namespace VariableAnalysis\Lib;
4

5
use VariableAnalysis\Lib\ScopeType;
6

7
/**
8
 * Holds details of a variable within a scope.
9
 */
10
class VariableInfo
11
{
12
        /**
13
         * @var string
14
         */
15
        public $name;
16

17
        /**
18
         * What scope the variable has: local, param, static, global, bound
19
         *
20
         * @var ScopeType::PARAM|ScopeType::BOUND|ScopeType::LOCAL|ScopeType::GLOBALSCOPE|ScopeType::STATICSCOPE|null
21
         */
22
        public $scopeType;
23

24
        /**
25
         * @var string|null
26
         */
27
        public $typeHint;
28

29
        /**
30
         * @var int|null
31
         */
32
        public $referencedVariableScope;
33

34
        /**
35
         * True if the variable is a reference but one created at runtime
36
         *
37
         * @var bool
38
         */
39
        public $isDynamicReference = false;
40

41
        /**
42
         * Stack pointer of first declaration
43
         *
44
         * Declaration is when a variable is created but has no value assigned.
45
         *
46
         * Assignment by reference is also a declaration and not an initialization.
47
         *
48
         * @var int|null
49
         */
50
        public $firstDeclared;
51

52
        /**
53
         * Stack pointer of first initialization
54
         *
55
         * @var int|null
56
         */
57
        public $firstInitialized;
58

59
        /**
60
         * Stack pointer of first read
61
         *
62
         * @var int|null
63
         */
64
        public $firstRead;
65

66
        /**
67
         * Stack pointers of all assignments
68
         *
69
         * This includes both declarations and initializations and may contain
70
         * duplicates!
71
         *
72
         * @var int[]
73
         */
74
        public $allAssignments = [];
75

76
        /**
77
         * @var bool
78
         */
79
        public $ignoreUnused = false;
80

81
        /**
82
         * @var bool
83
         */
84
        public $ignoreUndefined = false;
85

86
        /**
87
         * @var bool
88
         */
89
        public $isForeachLoopAssociativeValue = false;
90

91
        /**
92
         * @var array<ScopeType::PARAM|ScopeType::BOUND|ScopeType::LOCAL|ScopeType::GLOBALSCOPE|ScopeType::STATICSCOPE, string>
93
         */
94
        public static $scopeTypeDescriptions = [
95
                ScopeType::LOCAL  => 'variable',
96
                ScopeType::PARAM  => 'function parameter',
97
                ScopeType::STATICSCOPE => 'static variable',
98
                ScopeType::GLOBALSCOPE => 'global variable',
99
                ScopeType::BOUND  => 'bound variable',
100
        ];
101

102
        /**
103
         * @param string $varName
104
         */
105
        public function __construct($varName)
344✔
106
        {
107
                $this->name = $varName;
344✔
108
        }
172✔
109
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc