@@ -31,166 +31,6 @@ protected function getRule(): Rule
3131
3232 public function testAccessStaticProperties (): void
3333 {
34- if (PHP_VERSION_ID >= 80200 ) {
35- $ this ->markTestSkipped ('Test is not for PHP 8.2. ' );
36- }
37- $ this ->analyse ([__DIR__ . '/data/access-static-properties.php ' ], [
38- [
39- 'Access to an undefined static property FooAccessStaticProperties::$bar. ' ,
40- 23 ,
41- ],
42- [
43- 'Access to an undefined static property BarAccessStaticProperties::$bar. ' ,
44- 24 ,
45- ],
46- [
47- 'Access to an undefined static property FooAccessStaticProperties::$bar. ' ,
48- 25 ,
49- ],
50- [
51- 'Static access to instance property FooAccessStaticProperties::$loremIpsum. ' ,
52- 26 ,
53- ],
54- [
55- 'IpsumAccessStaticProperties::ipsum() accesses parent::$lorem but IpsumAccessStaticProperties does not extend any class. ' ,
56- 42 ,
57- ],
58- [
59- 'Access to protected property $foo of class FooAccessStaticProperties. ' ,
60- 44 ,
61- ],
62- [
63- 'Access to static property $test on an unknown class UnknownStaticProperties. ' ,
64- 47 ,
65- 'Learn more at https://phpstan.org/user-guide/discovering-symbols ' ,
66- ],
67- [
68- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$baz. ' ,
69- 53 ,
70- ],
71- [
72- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$nonexistent. ' ,
73- 55 ,
74- ],
75- [
76- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$emptyBaz. ' ,
77- 63 ,
78- ],
79- [
80- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$emptyNonexistent. ' ,
81- 65 ,
82- ],
83- [
84- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$anotherNonexistent. ' ,
85- 71 ,
86- ],
87- [
88- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$anotherNonexistent. ' ,
89- 72 ,
90- ],
91- [
92- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$anotherEmptyNonexistent. ' ,
93- 75 ,
94- ],
95- [
96- 'Access to an undefined static property static(IpsumAccessStaticProperties)::$anotherEmptyNonexistent. ' ,
97- 78 ,
98- ],
99- [
100- 'Accessing self::$staticFooProperty outside of class scope. ' ,
101- 84 ,
102- ],
103- [
104- 'Accessing static::$staticFooProperty outside of class scope. ' ,
105- 85 ,
106- ],
107- [
108- 'Accessing parent::$staticFooProperty outside of class scope. ' ,
109- 86 ,
110- ],
111- [
112- 'Access to protected property $foo of class FooAccessStaticProperties. ' ,
113- 89 ,
114- ],
115- [
116- 'Static access to instance property FooAccessStaticProperties::$loremIpsum. ' ,
117- 90 ,
118- ],
119- [
120- 'Access to an undefined static property FooAccessStaticProperties::$nonexistent. ' ,
121- 94 ,
122- ],
123- [
124- 'Access to static property $test on an unknown class NonexistentClass. ' ,
125- 97 ,
126- 'Learn more at https://phpstan.org/user-guide/discovering-symbols ' ,
127- ],
128- [
129- 'Access to an undefined static property FooAccessStaticProperties&SomeInterface::$nonexistent. ' ,
130- 108 ,
131- ],
132- [
133- 'Cannot access static property $foo on int|string. ' ,
134- 113 ,
135- ],
136- [
137- 'Class FooAccessStaticProperties referenced with incorrect case: FOOAccessStaticPropertieS. ' ,
138- 119 ,
139- ],
140- [
141- 'Access to an undefined static property FooAccessStaticProperties::$unknownProperties. ' ,
142- 119 ,
143- ],
144- [
145- 'Class FooAccessStaticProperties referenced with incorrect case: FOOAccessStaticPropertieS. ' ,
146- 120 ,
147- ],
148- [
149- 'Static access to instance property FooAccessStaticProperties::$loremIpsum. ' ,
150- 120 ,
151- ],
152- [
153- 'Class FooAccessStaticProperties referenced with incorrect case: FOOAccessStaticPropertieS. ' ,
154- 121 ,
155- ],
156- [
157- 'Access to protected property $foo of class FooAccessStaticProperties. ' ,
158- 121 ,
159- ],
160- [
161- 'Class FooAccessStaticProperties referenced with incorrect case: FOOAccessStaticPropertieS. ' ,
162- 122 ,
163- ],
164- [
165- 'Access to an undefined static property ClassOrString|string::$unknownProperty. ' ,
166- 141 ,
167- ],
168- [
169- 'Static access to instance property ClassOrString::$instanceProperty. ' ,
170- 152 ,
171- ],
172- [
173- 'Access to static property $foo on an unknown class TraitWithStaticProperty. ' ,
174- 209 ,
175- 'Learn more at https://phpstan.org/user-guide/discovering-symbols ' ,
176- ],
177- [
178- 'Static access to instance property AccessWithStatic::$bar. ' ,
179- 223 ,
180- ],
181- [
182- 'Access to an undefined static property static(AccessWithStatic)::$nonexistent. ' ,
183- 224 ,
184- ],
185- ]);
186- }
187-
188- public function testAccessStaticPropertiesPhp82 (): void
189- {
190- if (PHP_VERSION_ID < 80200 ) {
191- $ this ->markTestSkipped ('Test requires PHP 8.2. ' );
192- }
193-
19434 $ this ->analyse ([__DIR__ . '/data/access-static-properties.php ' ], [
19535 [
19636 'Access to an undefined static property FooAccessStaticProperties::$bar. ' ,
@@ -436,14 +276,12 @@ public function testBug5143(): void
436276
437277 public function testBug6809 (): void
438278 {
439- $ errors = [];
440- if (PHP_VERSION_ID >= 80200 ) {
441- $ errors [] = [
279+ $ this ->analyse ([__DIR__ . '/data/bug-6809.php ' ], [
280+ [
442281 'Access to an undefined static property static(Bug6809\HelloWorld)::$coolClass. ' ,
443282 7 ,
444- ];
445- }
446- $ this ->analyse ([__DIR__ . '/data/bug-6809.php ' ], $ errors );
283+ ],
284+ ]);
447285 }
448286
449287 public function testBug8333 (): void
0 commit comments