Skip to content

Commit b530b0d

Browse files
committed
Fix discrepancy between lint >= and PHP_VERSION_ID in NodeScopeResolverTest
1 parent f6b9898 commit b530b0d

File tree

1 file changed

+60
-30
lines changed

1 file changed

+60
-30
lines changed

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public function dataFileAsserts(): iterable
4040

4141
yield from $this->gatherAssertTypes(__DIR__ . '/data/generic-generalization.php');
4242

43-
yield from $this->gatherAssertTypes(__DIR__ . '/data/named-arguments.php');
43+
if (PHP_VERSION_ID >= 80000) {
44+
yield from $this->gatherAssertTypes(__DIR__ . '/data/named-arguments.php');
45+
}
4446
yield from $this->gatherAssertTypes(__DIR__ . '/data/date.php');
4547
yield from $this->gatherAssertTypes(__DIR__ . '/data/instanceof.php');
4648
yield from $this->gatherAssertTypes(__DIR__ . '/data/integer-range-types.php');
@@ -121,7 +123,11 @@ public function dataFileAsserts(): iterable
121123
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3269.php');
122124
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5086.php');
123125
yield from $this->gatherAssertTypes(__DIR__ . '/data/assign-nested-arrays.php');
124-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3276.php');
126+
127+
if (PHP_VERSION_ID >= 70400) {
128+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3276.php');
129+
}
130+
125131
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-6856.php');
126132
yield from $this->gatherAssertTypes(__DIR__ . '/data/shadowed-trait-methods.php');
127133
yield from $this->gatherAssertTypes(__DIR__ . '/data/const-in-functions.php');
@@ -144,11 +150,11 @@ public function dataFileAsserts(): iterable
144150
yield from $this->gatherAssertTypes(__DIR__ . '/data/graphics-draw-return-types.php');
145151
}
146152

147-
yield from $this->gatherAssertTypes(__DIR__ . '/../Reflection/data/unionTypes.php');
148-
149-
yield from $this->gatherAssertTypes(__DIR__ . '/../Reflection/data/mixedType.php');
150-
151-
yield from $this->gatherAssertTypes(__DIR__ . '/../Reflection/data/staticReturnType.php');
153+
if (PHP_VERSION_ID >= 80000) {
154+
yield from $this->gatherAssertTypes(__DIR__ . '/../Reflection/data/unionTypes.php');
155+
yield from $this->gatherAssertTypes(__DIR__ . '/../Reflection/data/mixedType.php');
156+
yield from $this->gatherAssertTypes(__DIR__ . '/../Reflection/data/staticReturnType.php');
157+
}
152158

153159
yield from $this->gatherAssertTypes(__DIR__ . '/data/minmax.php');
154160
if (PHP_VERSION_ID < 80000) {
@@ -183,8 +189,14 @@ public function dataFileAsserts(): iterable
183189
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-1014.php');
184190
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-pr-339.php');
185191
yield from $this->gatherAssertTypes(__DIR__ . '/data/pow.php');
186-
yield from $this->gatherAssertTypes(__DIR__ . '/data/throw-expr.php');
187-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5351.php');
192+
193+
if (PHP_VERSION_ID >= 80000) {
194+
yield from $this->gatherAssertTypes(__DIR__ . '/data/throw-expr.php');
195+
}
196+
197+
if (PHP_VERSION_ID >= 80000) {
198+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5351.php');
199+
}
188200

189201
yield from $this->gatherAssertTypes(__DIR__ . '/data/non-empty-array.php');
190202

@@ -237,7 +249,9 @@ public function dataFileAsserts(): iterable
237249
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-9084.php');
238250
}
239251

240-
yield from $this->gatherAssertTypes(__DIR__ . '/data/promoted-properties-types.php');
252+
if (PHP_VERSION_ID >= 80000) {
253+
yield from $this->gatherAssertTypes(__DIR__ . '/data/promoted-properties-types.php');
254+
}
241255

242256
yield from $this->gatherAssertTypes(__DIR__ . '/data/early-termination-phpdoc.php');
243257

@@ -272,9 +286,10 @@ public function dataFileAsserts(): iterable
272286
yield from $this->gatherAssertTypes(__DIR__ . '/data/enum-reflection-php81.php');
273287
}
274288

275-
yield from $this->gatherAssertTypes(__DIR__ . '/data/match-expr.php');
276-
277-
yield from $this->gatherAssertTypes(__DIR__ . '/data/nullsafe.php');
289+
if (PHP_VERSION_ID >= 80000) {
290+
yield from $this->gatherAssertTypes(__DIR__ . '/data/match-expr.php');
291+
yield from $this->gatherAssertTypes(__DIR__ . '/data/nullsafe.php');
292+
}
278293

279294
yield from $this->gatherAssertTypes(__DIR__ . '/data/specified-types-closure-use.php');
280295
yield from $this->gatherAssertTypes(__DIR__ . '/data/specified-types-closure-edge.php');
@@ -500,7 +515,10 @@ public function dataFileAsserts(): iterable
500515
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4820.php');
501516
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4822.php');
502517
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4816.php');
503-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4757.php');
518+
519+
if (PHP_VERSION_ID >= 80000) {
520+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4757.php');
521+
}
504522
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4814.php');
505523
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4982.php');
506524
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4761.php');
@@ -515,7 +533,11 @@ public function dataFileAsserts(): iterable
515533
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5000.php');
516534
yield from $this->gatherAssertTypes(__DIR__ . '/data/number_format.php');
517535
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5140.php');
518-
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Comparison/data/bug-4857.php');
536+
537+
if (PHP_VERSION_ID >= 80000) {
538+
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Comparison/data/bug-4857.php');
539+
}
540+
519541
yield from $this->gatherAssertTypes(__DIR__ . '/data/empty-array-shape.php');
520542
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-5089.php');
521543
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3158.php');
@@ -525,10 +547,13 @@ public function dataFileAsserts(): iterable
525547

526548
yield from $this->gatherAssertTypes(__DIR__ . '/data/uksort-bug.php');
527549

528-
yield from $this->gatherAssertTypes(__DIR__ . '/data/arrow-function-types.php');
550+
if (PHP_VERSION_ID >= 70400) {
551+
yield from $this->gatherAssertTypes(__DIR__ . '/data/arrow-function-types.php');
552+
}
553+
529554
if (PHP_VERSION_ID >= 80000) {
530555
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4902-php8.php');
531-
} else {
556+
} elseif (PHP_VERSION_ID >= 70400) {
532557
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4902.php');
533558
}
534559

@@ -561,7 +586,10 @@ public function dataFileAsserts(): iterable
561586
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5336.php');
562587
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6845.php');
563588
yield from $this->gatherAssertTypes(__DIR__ . '/data/splfixedarray-iterator-types.php');
564-
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-5372.php');
589+
590+
if (PHP_VERSION_ID >= 70400) {
591+
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-5372.php');
592+
}
565593
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Arrays/data/bug-5372_2.php');
566594

567595
if (PHP_VERSION_ID >= 80000) {
@@ -577,6 +605,7 @@ public function dataFileAsserts(): iterable
577605

578606
if (PHP_VERSION_ID >= 80000) {
579607
yield from $this->gatherAssertTypes(__DIR__ . '/data/reflectionclass-issue-5511-php8.php');
608+
yield from $this->gatherAssertTypes(__DIR__ . '/data/model-mixin.php');
580609
}
581610

582611
yield from $this->gatherAssertTypes(__DIR__ . '/data/modulo-operator.php');
@@ -585,8 +614,6 @@ public function dataFileAsserts(): iterable
585614

586615
yield from $this->gatherAssertTypes(__DIR__ . '/data/filter-var-returns-non-empty-string.php');
587616

588-
yield from $this->gatherAssertTypes(__DIR__ . '/data/model-mixin.php');
589-
590617
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5529.php');
591618

592619
if (PHP_VERSION_ID >= 80000) {
@@ -654,18 +681,18 @@ public function dataFileAsserts(): iterable
654681
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5458.php');
655682
}
656683

657-
yield from $this->gatherAssertTypes(__DIR__ . '/data/never.php');
684+
if (PHP_VERSION_ID >= 80100) {
685+
yield from $this->gatherAssertTypes(__DIR__ . '/data/never.php');
686+
}
658687

659688
if (PHP_VERSION_ID >= 80100) {
660689
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10627.php');
690+
yield from $this->gatherAssertTypes(__DIR__ . '/data/native-intersection.php');
691+
yield from $this->gatherAssertTypes(__DIR__ . '/data/new-in-initializers.php');
661692
}
662693

663-
yield from $this->gatherAssertTypes(__DIR__ . '/data/native-intersection.php');
664-
665694
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-2760.php');
666695

667-
yield from $this->gatherAssertTypes(__DIR__ . '/data/new-in-initializers.php');
668-
669696
if (PHP_VERSION_ID >= 80100) {
670697
define('TEST_OBJECT_CONSTANT', new stdClass());
671698
define('TEST_NULL_CONSTANT', null);
@@ -676,9 +703,8 @@ public function dataFileAsserts(): iterable
676703
yield from $this->gatherAssertTypes(__DIR__ . '/data/new-in-initializers-runtime.php');
677704
}
678705

679-
yield from $this->gatherAssertTypes(__DIR__ . '/data/first-class-callables.php');
680-
681706
if (PHP_VERSION_ID >= 80100) {
707+
yield from $this->gatherAssertTypes(__DIR__ . '/data/first-class-callables.php');
682708
yield from $this->gatherAssertTypes(__DIR__ . '/data/array-is-list-type-specifying.php');
683709
yield from $this->gatherAssertTypes(__DIR__ . '/data/array-is-list-unset.php');
684710
}
@@ -1206,7 +1232,7 @@ public function dataFileAsserts(): iterable
12061232
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8017.php');
12071233
yield from $this->gatherAssertTypes(__DIR__ . '/data/global-namespace.php');
12081234

1209-
if (PHP_VERSION_ID >= 80000) {
1235+
if (PHP_VERSION_ID >= 80200) {
12101236
yield from $this->gatherAssertTypes(__DIR__ . '/data/dnf.php');
12111237
}
12121238

@@ -1436,8 +1462,12 @@ public function dataFileAsserts(): iterable
14361462
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7915.php');
14371463
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-9714.php');
14381464
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-9105.php');
1439-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5172.php');
1440-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-9293.php');
1465+
1466+
if (PHP_VERSION_ID >= 80000) {
1467+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5172.php');
1468+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-9293.php');
1469+
}
1470+
14411471
yield from $this->gatherAssertTypes(__DIR__ . '/data/nullsafe-vs-scalar.php');
14421472
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8517.php');
14431473
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Functions/data/bug-9803.php');

0 commit comments

Comments
 (0)