@@ -25,13 +25,190 @@ class NodeScopeResolverTest extends TypeInferenceTestCase
2525 */
2626 private static function findTestFiles (): iterable
2727 {
28- yield __DIR__ . '/nsrt/static-with-this-chained.php ' ;
28+ foreach (self ::findTestDataFilesFromDirectory (__DIR__ . '/nsrt ' ) as $ testFile ) {
29+ yield $ testFile ;
30+ }
31+
32+ if (PHP_VERSION_ID < 80200 && PHP_VERSION_ID >= 80100 ) {
33+ yield __DIR__ . '/data/enum-reflection-php81.php ' ;
34+ }
35+
36+ if (PHP_VERSION_ID < 80000 && PHP_VERSION_ID >= 70400 ) {
37+ yield __DIR__ . '/data/bug-4902.php ' ;
38+ }
39+
40+ if (PHP_VERSION_ID < 80300 ) {
41+ if (PHP_VERSION_ID >= 80200 ) {
42+ yield __DIR__ . '/data/mb-strlen-php82.php ' ;
43+ } elseif (PHP_VERSION_ID >= 80000 ) {
44+ yield __DIR__ . '/data/mb-strlen-php8.php ' ;
45+ } elseif (PHP_VERSION_ID < 70300 ) {
46+ yield __DIR__ . '/data/mb-strlen-php72.php ' ;
47+ } else {
48+ yield __DIR__ . '/data/mb-strlen-php73.php ' ;
49+ }
50+ }
51+
52+ yield __DIR__ . '/../Rules/Methods/data/bug-6856.php ' ;
53+
54+ if (PHP_VERSION_ID < 80000 ) {
55+ yield __DIR__ . '/data/explode-php74.php ' ;
56+ } else {
57+ yield __DIR__ . '/data/explode-php80.php ' ;
58+ }
2959
3060 if (PHP_VERSION_ID >= 80000 ) {
3161 yield __DIR__ . '/../Reflection/data/unionTypes.php ' ;
3262 yield __DIR__ . '/../Reflection/data/mixedType.php ' ;
3363 yield __DIR__ . '/../Reflection/data/staticReturnType.php ' ;
3464 }
65+
66+ if (PHP_INT_SIZE === 8 ) {
67+ yield __DIR__ . '/data/predefined-constants-64bit.php ' ;
68+ } else {
69+ yield __DIR__ . '/data/predefined-constants-32bit.php ' ;
70+ }
71+
72+ yield __DIR__ . '/../Rules/Variables/data/bug-10577.php ' ;
73+ yield __DIR__ . '/../Rules/Variables/data/bug-10610.php ' ;
74+ yield __DIR__ . '/../Rules/Comparison/data/bug-2550.php ' ;
75+ yield __DIR__ . '/../Rules/Properties/data/bug-3777.php ' ;
76+ yield __DIR__ . '/../Rules/Methods/data/bug-4552.php ' ;
77+ yield __DIR__ . '/../Rules/Methods/data/infer-array-key.php ' ;
78+ yield __DIR__ . '/../Rules/Generics/data/bug-3769.php ' ;
79+ yield __DIR__ . '/../Rules/Generics/data/bug-6301.php ' ;
80+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-4643.php ' ;
81+
82+ if (PHP_VERSION_ID >= 80000 ) {
83+ yield __DIR__ . '/../Rules/Comparison/data/bug-4857.php ' ;
84+ }
85+
86+ yield __DIR__ . '/../Rules/Methods/data/bug-5089.php ' ;
87+ yield __DIR__ . '/../Rules/Methods/data/unable-to-resolve-callback-parameter-type.php ' ;
88+
89+ yield __DIR__ . '/../Rules/Functions/data/varying-acceptor.php ' ;
90+ yield __DIR__ . '/../Rules/Methods/data/bug-4415.php ' ;
91+ if (PHP_VERSION_ID >= 70400 ) {
92+ yield __DIR__ . '/../Rules/Methods/data/bug-5372.php ' ;
93+ }
94+ yield __DIR__ . '/../Rules/Arrays/data/bug-5372_2.php ' ;
95+ yield __DIR__ . '/../Rules/Methods/data/bug-5562.php ' ;
96+
97+ if (PHP_VERSION_ID >= 80100 ) {
98+ define ('TEST_OBJECT_CONSTANT ' , new stdClass ());
99+ define ('TEST_NULL_CONSTANT ' , null );
100+ define ('TEST_TRUE_CONSTANT ' , true );
101+ define ('TEST_FALSE_CONSTANT ' , false );
102+ define ('TEST_ARRAY_CONSTANT ' , [true , false , null ]);
103+ define ('TEST_ENUM_CONSTANT ' , Foo::ONE );
104+ yield __DIR__ . '/data/new-in-initializers-runtime.php ' ;
105+ }
106+
107+ if (PHP_VERSION_ID >= 70400 ) {
108+ yield __DIR__ . '/../Rules/Comparison/data/bug-6473.php ' ;
109+ }
110+
111+ yield __DIR__ . '/../Rules/Methods/data/filter-iterator-child-class.php ' ;
112+
113+ yield __DIR__ . '/../Rules/Methods/data/bug-5749.php ' ;
114+ yield __DIR__ . '/../Rules/Methods/data/bug-5757.php ' ;
115+
116+ if (PHP_VERSION_ID >= 80000 ) {
117+ yield __DIR__ . '/../Rules/Methods/data/bug-6635.php ' ;
118+ }
119+
120+ if (PHP_VERSION_ID >= 80300 ) {
121+ yield __DIR__ . '/../Rules/Constants/data/bug-10212.php ' ;
122+ }
123+
124+ yield __DIR__ . '/../Rules/Methods/data/bug-3284.php ' ;
125+
126+ if (PHP_VERSION_ID >= 80300 ) {
127+ yield __DIR__ . '/../Rules/Methods/data/return-type-class-constant.php ' ;
128+ }
129+
130+ //define('ALREADY_DEFINED_CONSTANT', true);
131+ //yield from $this->gatherAssertTypes(__DIR__ . '/data/already-defined-constant.php');
132+
133+ yield __DIR__ . '/../Rules/Methods/data/conditional-complex-templates.php ' ;
134+
135+ yield __DIR__ . '/../Rules/Methods/data/bug-7511.php ' ;
136+ yield __DIR__ . '/../Rules/Properties/data/trait-mixin.php ' ;
137+ yield __DIR__ . '/../Rules/Methods/data/trait-mixin.php ' ;
138+ yield __DIR__ . '/../Rules/Comparison/data/bug-4708.php ' ;
139+ yield __DIR__ . '/../Rules/Functions/data/bug-7156.php ' ;
140+ yield __DIR__ . '/../Rules/Arrays/data/bug-6364.php ' ;
141+ yield __DIR__ . '/../Rules/Arrays/data/bug-5758.php ' ;
142+ yield __DIR__ . '/../Rules/Functions/data/bug-3931.php ' ;
143+ yield __DIR__ . '/../Rules/Variables/data/bug-7417.php ' ;
144+ yield __DIR__ . '/../Rules/Arrays/data/bug-7469.php ' ;
145+ yield __DIR__ . '/../Rules/Variables/data/bug-3391.php ' ;
146+
147+ if (PHP_VERSION_ID >= 70400 ) {
148+ yield __DIR__ . '/../Rules/Functions/data/bug-anonymous-function-method-constant.php ' ;
149+ }
150+
151+ if (PHP_VERSION_ID >= 80200 ) {
152+ yield __DIR__ . '/../Rules/Methods/data/true-typehint.php ' ;
153+ }
154+ yield __DIR__ . '/../Rules/Arrays/data/bug-6000.php ' ;
155+
156+ yield __DIR__ . '/../Rules/Arrays/data/slevomat-foreach-unset-bug.php ' ;
157+ yield __DIR__ . '/../Rules/Arrays/data/slevomat-foreach-array-key-exists-bug.php ' ;
158+
159+ if (PHP_VERSION_ID >= 80000 ) {
160+ yield __DIR__ . '/../Rules/Comparison/data/bug-7898.php ' ;
161+ }
162+
163+ if (PHP_VERSION_ID >= 80000 ) {
164+ yield __DIR__ . '/../Rules/Functions/data/bug-7823.php ' ;
165+ }
166+
167+ yield __DIR__ . '/../Analyser/data/is-resource-specified.php ' ;
168+
169+ yield __DIR__ . '/../Rules/Arrays/data/bug-7954.php ' ;
170+ yield __DIR__ . '/../Rules/Comparison/data/docblock-assert-equality.php ' ;
171+ yield __DIR__ . '/../Rules/Properties/data/bug-7839.php ' ;
172+ yield __DIR__ . '/../Rules/Classes/data/bug-5333.php ' ;
173+ yield __DIR__ . '/../Rules/Methods/data/bug-8174.php ' ;
174+ yield __DIR__ . '/../Rules/Comparison/data/bug-8169.php ' ;
175+ yield __DIR__ . '/../Rules/Functions/data/bug-8280.php ' ;
176+ yield __DIR__ . '/../Rules/Comparison/data/bug-8277.php ' ;
177+ yield __DIR__ . '/../Rules/Variables/data/bug-8113.php ' ;
178+ yield __DIR__ . '/../Rules/Functions/data/bug-8389.php ' ;
179+ yield __DIR__ . '/../Rules/Arrays/data/bug-8467a.php ' ;
180+ if (PHP_VERSION_ID >= 80100 ) {
181+ yield __DIR__ . '/../Rules/Comparison/data/bug-8485.php ' ;
182+ }
183+
184+ if (PHP_VERSION_ID >= 80100 ) {
185+ yield __DIR__ . '/../Rules/Comparison/data/bug-9007.php ' ;
186+ }
187+
188+ yield __DIR__ . '/../Rules/DeadCode/data/bug-8620.php ' ;
189+
190+ if (PHP_VERSION_ID >= 80200 ) {
191+ yield __DIR__ . '/../Rules/Constants/data/bug-8957.php ' ;
192+ }
193+
194+ if (PHP_VERSION_ID >= 80100 ) {
195+ yield __DIR__ . '/../Rules/Comparison/data/bug-9499.php ' ;
196+ }
197+
198+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-8609-function.php ' ;
199+ yield __DIR__ . '/../Rules/Comparison/data/bug-5365.php ' ;
200+ yield __DIR__ . '/../Rules/Comparison/data/bug-6551.php ' ;
201+ yield __DIR__ . '/../Rules/Variables/data/bug-9403.php ' ;
202+ yield __DIR__ . '/../Rules/Methods/data/bug-9542.php ' ;
203+ yield __DIR__ . '/../Rules/Functions/data/bug-9803.php ' ;
204+ yield __DIR__ . '/../Rules/PhpDoc/data/bug-10594.php ' ;
205+ yield __DIR__ . '/../Rules/Classes/data/bug-11591.php ' ;
206+ yield __DIR__ . '/../Rules/Classes/data/bug-11591-method-tag.php ' ;
207+ yield __DIR__ . '/../Rules/Classes/data/bug-11591-property-tag.php ' ;
208+ yield __DIR__ . '/../Rules/Classes/data/mixin-trait-use.php ' ;
209+
210+ yield __DIR__ . '/../Rules/Methods/data/bug-4801.php ' ;
211+ yield __DIR__ . '/data/template-default.php ' ;
35212 }
36213
37214 /**
0 commit comments