@@ -27,13 +27,228 @@ class NodeScopeResolverTest extends TypeInferenceTestCase
2727 */
2828 private static function findTestFiles (): iterable
2929 {
30- yield __DIR__ . '/nsrt/static-with-this-chained.php ' ;
30+ foreach (self ::findTestDataFilesFromDirectory (__DIR__ . '/nsrt ' ) as $ testFile ) {
31+ yield $ testFile ;
32+ }
33+
34+ if (PHP_VERSION_ID < 80200 && PHP_VERSION_ID >= 80100 ) {
35+ yield __DIR__ . '/data/enum-reflection-php81.php ' ;
36+ }
37+
38+ if (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80400 ) {
39+ yield __DIR__ . '/data/enum-reflection-backed.php ' ;
40+ }
41+
42+ if (PHP_VERSION_ID < 80000 ) {
43+ yield __DIR__ . '/data/bug-4902.php ' ;
44+ }
45+
46+ if (PHP_VERSION_ID < 80300 ) {
47+ if (PHP_VERSION_ID >= 80200 ) {
48+ yield __DIR__ . '/data/mb-strlen-php82.php ' ;
49+ } elseif (PHP_VERSION_ID >= 80000 ) {
50+ yield __DIR__ . '/data/mb-strlen-php8.php ' ;
51+ } else {
52+ yield __DIR__ . '/data/mb-strlen-php73.php ' ;
53+ }
54+ }
55+
56+ if (PHP_VERSION_ID >= 80200 ) {
57+ yield __DIR__ . '/data/str-split-php82.php ' ;
58+ } elseif (PHP_VERSION_ID >= 80000 ) {
59+ yield __DIR__ . '/data/str-split-php80.php ' ;
60+ } else {
61+ yield __DIR__ . '/data/str-split-php74.php ' ;
62+ }
63+ if (PHP_VERSION_ID >= 80200 ) {
64+ yield __DIR__ . '/data/mb-str-split-php82.php ' ;
65+ } elseif (PHP_VERSION_ID >= 80000 ) {
66+ yield __DIR__ . '/data/mb-str-split-php80.php ' ;
67+ } elseif (PHP_VERSION_ID >= 74000 ) {
68+ yield __DIR__ . '/data/mb-str-split-php74.php ' ;
69+ }
70+
71+ yield __DIR__ . '/../Rules/Methods/data/bug-6856.php ' ;
72+ yield __DIR__ . '/../Rules/Arrays/data/bug-12981.php ' ;
73+
74+ if (PHP_VERSION_ID < 80000 ) {
75+ yield __DIR__ . '/data/explode-php74.php ' ;
76+ } else {
77+ yield __DIR__ . '/data/explode-php80.php ' ;
78+ }
79+
80+ if (PHP_VERSION_ID >= 80100 ) {
81+ yield __DIR__ . '/data/reflection-type-php81.php ' ;
82+ } else {
83+ yield __DIR__ . '/data/reflection-type-prePhp81.php ' ;
84+ }
3185
3286 if (PHP_VERSION_ID >= 80000 ) {
3387 yield __DIR__ . '/../Reflection/data/unionTypes.php ' ;
3488 yield __DIR__ . '/../Reflection/data/mixedType.php ' ;
3589 yield __DIR__ . '/../Reflection/data/staticReturnType.php ' ;
3690 }
91+
92+ if (PHP_INT_SIZE === 8 ) {
93+ yield __DIR__ . '/data/predefined-constants-64bit.php ' ;
94+ } else {
95+ yield __DIR__ . '/data/predefined-constants-32bit.php ' ;
96+ }
97+
98+ yield __DIR__ . '/../Rules/Variables/data/bug-10577.php ' ;
99+ yield __DIR__ . '/../Rules/Variables/data/bug-10610.php ' ;
100+ yield __DIR__ . '/../Rules/Comparison/data/bug-2550.php ' ;
101+ yield __DIR__ . '/../Rules/Comparison/data/bug-12412.php ' ;
102+ yield __DIR__ . '/../Rules/Properties/data/bug-3777.php ' ;
103+ yield __DIR__ . '/../Rules/Methods/data/bug-4552.php ' ;
104+ yield __DIR__ . '/../Rules/Methods/data/infer-array-key.php ' ;
105+ yield __DIR__ . '/../Rules/Generics/data/bug-3769.php ' ;
106+ yield __DIR__ . '/../Rules/Generics/data/bug-6301.php ' ;
107+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-4643.php ' ;
108+ yield __DIR__ . '/../Rules/Arrays/data/bug-13538.php ' ;
109+
110+ if (PHP_VERSION_ID >= 80000 ) {
111+ yield __DIR__ . '/../Rules/Comparison/data/bug-4857.php ' ;
112+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-13652.php ' ;
113+ }
114+
115+ yield __DIR__ . '/../Rules/Methods/data/bug-5089.php ' ;
116+ yield __DIR__ . '/../Rules/Methods/data/unable-to-resolve-callback-parameter-type.php ' ;
117+
118+ yield __DIR__ . '/../Rules/Functions/data/varying-acceptor.php ' ;
119+ yield __DIR__ . '/../Rules/Methods/data/bug-4415.php ' ;
120+ yield __DIR__ . '/../Rules/Methods/data/bug-5372.php ' ;
121+ yield __DIR__ . '/../Rules/Arrays/data/bug-5372_2.php ' ;
122+ yield __DIR__ . '/../Rules/Methods/data/bug-5562.php ' ;
123+
124+ if (PHP_VERSION_ID >= 80100 ) {
125+ define ('TEST_OBJECT_CONSTANT ' , new stdClass ());
126+ define ('TEST_NULL_CONSTANT ' , null );
127+ define ('TEST_TRUE_CONSTANT ' , true );
128+ define ('TEST_FALSE_CONSTANT ' , false );
129+ define ('TEST_ARRAY_CONSTANT ' , [true , false , null ]);
130+ define ('TEST_ENUM_CONSTANT ' , Foo::ONE );
131+ yield __DIR__ . '/data/new-in-initializers-runtime.php ' ;
132+ yield __DIR__ . '/data/scope-in-enum-match-arm-body.php ' ;
133+ }
134+
135+ yield __DIR__ . '/../Rules/Comparison/data/bug-6473.php ' ;
136+
137+ yield __DIR__ . '/../Rules/Methods/data/filter-iterator-child-class.php ' ;
138+
139+ yield __DIR__ . '/../Rules/Methods/data/bug-5749.php ' ;
140+ yield __DIR__ . '/../Rules/Methods/data/bug-5757.php ' ;
141+
142+ if (PHP_VERSION_ID >= 80000 ) {
143+ yield __DIR__ . '/../Rules/Methods/data/bug-6635.php ' ;
144+ }
145+
146+ if (PHP_VERSION_ID >= 80300 ) {
147+ yield __DIR__ . '/../Rules/Constants/data/bug-10212.php ' ;
148+ }
149+
150+ yield __DIR__ . '/../Rules/Methods/data/bug-3284.php ' ;
151+
152+ if (PHP_VERSION_ID >= 80300 ) {
153+ yield __DIR__ . '/../Rules/Methods/data/return-type-class-constant.php ' ;
154+ }
155+
156+ //define('ALREADY_DEFINED_CONSTANT', true);
157+ //yield from self::gatherAssertTypes(__DIR__ . '/data/already-defined-constant.php');
158+
159+ yield __DIR__ . '/../Rules/Methods/data/conditional-complex-templates.php ' ;
160+
161+ yield __DIR__ . '/../Rules/Methods/data/bug-7511.php ' ;
162+ yield __DIR__ . '/../Rules/Properties/data/trait-mixin.php ' ;
163+ yield __DIR__ . '/../Rules/Methods/data/trait-mixin.php ' ;
164+ yield __DIR__ . '/../Rules/Comparison/data/bug-4708.php ' ;
165+ yield __DIR__ . '/../Rules/Functions/data/bug-7156.php ' ;
166+ yield __DIR__ . '/../Rules/Arrays/data/bug-6364.php ' ;
167+ yield __DIR__ . '/../Rules/Arrays/data/bug-5758.php ' ;
168+ yield __DIR__ . '/../Rules/Functions/data/bug-3931.php ' ;
169+ yield __DIR__ . '/../Rules/Variables/data/bug-7417.php ' ;
170+ yield __DIR__ . '/../Rules/Arrays/data/bug-7469.php ' ;
171+ yield __DIR__ . '/../Rules/Variables/data/bug-3391.php ' ;
172+
173+ yield __DIR__ . '/../Rules/Functions/data/bug-anonymous-function-method-constant.php ' ;
174+
175+ if (PHP_VERSION_ID >= 80200 ) {
176+ yield __DIR__ . '/../Rules/Methods/data/true-typehint.php ' ;
177+ }
178+ yield __DIR__ . '/../Rules/Arrays/data/bug-6000.php ' ;
179+
180+ yield __DIR__ . '/../Rules/Arrays/data/slevomat-foreach-unset-bug.php ' ;
181+ yield __DIR__ . '/../Rules/Arrays/data/slevomat-foreach-array-key-exists-bug.php ' ;
182+
183+ yield __DIR__ . '/../Rules/Methods/data/inherit-phpdoc-return-type-with-narrower-native-return-type.php ' ;
184+
185+ if (PHP_VERSION_ID >= 80000 ) {
186+ yield __DIR__ . '/../Rules/Comparison/data/bug-7898.php ' ;
187+ }
188+
189+ if (PHP_VERSION_ID >= 80000 ) {
190+ yield __DIR__ . '/../Rules/Functions/data/bug-7823.php ' ;
191+ }
192+
193+ yield __DIR__ . '/../Analyser/data/is-resource-specified.php ' ;
194+
195+ yield __DIR__ . '/../Rules/Arrays/data/bug-7954.php ' ;
196+ yield __DIR__ . '/../Rules/Comparison/data/docblock-assert-equality.php ' ;
197+ yield __DIR__ . '/../Rules/Properties/data/bug-7839.php ' ;
198+ yield __DIR__ . '/../Rules/Classes/data/bug-5333.php ' ;
199+ yield __DIR__ . '/../Rules/Methods/data/bug-8174.php ' ;
200+
201+ yield __DIR__ . '/../Rules/Properties/data/bug-13537.php ' ;
202+
203+ if (PHP_VERSION_ID >= 80000 ) {
204+ yield __DIR__ . '/../Rules/Comparison/data/bug-8169.php ' ;
205+ }
206+ yield __DIR__ . '/../Rules/Functions/data/bug-8280.php ' ;
207+ yield __DIR__ . '/../Rules/Comparison/data/bug-8277.php ' ;
208+ yield __DIR__ . '/../Rules/Variables/data/bug-8113.php ' ;
209+ yield __DIR__ . '/../Rules/Functions/data/bug-8389.php ' ;
210+ yield __DIR__ . '/../Rules/Arrays/data/bug-8467a.php ' ;
211+
212+ if (PHP_VERSION_ID >= 80100 ) {
213+ yield __DIR__ . '/../Rules/Comparison/data/bug-8485.php ' ;
214+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-11033.php ' ;
215+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-9708.php ' ;
216+ }
217+
218+ if (PHP_VERSION_ID >= 80100 ) {
219+ yield __DIR__ . '/../Rules/Comparison/data/bug-9007.php ' ;
220+ }
221+
222+ yield __DIR__ . '/../Rules/Generics/data/bug-9981.php ' ;
223+
224+ yield __DIR__ . '/../Rules/DeadCode/data/bug-8620.php ' ;
225+
226+ if (PHP_VERSION_ID >= 80200 ) {
227+ yield __DIR__ . '/../Rules/Constants/data/bug-8957.php ' ;
228+ }
229+
230+ if (PHP_VERSION_ID >= 80100 ) {
231+ yield __DIR__ . '/../Rules/Comparison/data/bug-9499.php ' ;
232+ }
233+
234+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-8609-function.php ' ;
235+ yield __DIR__ . '/../Rules/Comparison/data/bug-5365.php ' ;
236+ yield __DIR__ . '/../Rules/Comparison/data/bug-6551.php ' ;
237+ yield __DIR__ . '/../Rules/Variables/data/bug-9403.php ' ;
238+ yield __DIR__ . '/../Rules/Variables/data/bug-12364.php ' ;
239+ yield __DIR__ . '/../Rules/Methods/data/bug-9542.php ' ;
240+ yield __DIR__ . '/../Rules/Functions/data/bug-9803.php ' ;
241+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-10594.php ' ;
242+ yield __DIR__ . '/../Rules/Classes/data/bug-11591.php ' ;
243+ yield __DIR__ . '/../Rules/Classes/data/bug-11591-method-tag.php ' ;
244+ yield __DIR__ . '/../Rules/Classes/data/bug-11591-property-tag.php ' ;
245+ yield __DIR__ . '/../Rules/Classes/data/mixin-trait-use.php ' ;
246+
247+ yield __DIR__ . '/../Rules/Arrays/data/bug-11679.php ' ;
248+ yield __DIR__ . '/../Rules/Methods/data/bug-4801.php ' ;
249+ yield __DIR__ . '/../Rules/Arrays/data/narrow-superglobal.php ' ;
250+ yield __DIR__ . '/../Rules/Methods/data/bug-12927.php ' ;
251+ yield __DIR__ . '/../Rules/Properties/data/bug-14012.php ' ;
37252 }
38253
39254 /**
0 commit comments