Skip to content

Commit 8698991

Browse files
RequiredPhpVersionVisitor: report native union types as requiring PHP 8.0 (#5872)
Co-authored-by: VincentLanglet <9052536+VincentLanglet@users.noreply.github.com>
1 parent 23947f1 commit 8698991

28 files changed

Lines changed: 37 additions & 33 deletions

‎build/PHPStan/Build/RequiredPhpVersionVisitor.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function enterNode(Node $node): ?Node
6767
}
6868

6969
if ($node instanceof Node\UnionType) {
70+
$this->require(self::PHP_8_0, 'union types', $node);
7071
foreach ($node->types as $innerType) {
7172
if ($innerType instanceof Node\IntersectionType) {
7273
$this->require(self::PHP_8_2, 'disjunctive normal form types', $innerType);

‎tests/PHPStan/Analyser/data/bug-9860.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php declare(strict_types = 1);
1+
<?php declare(strict_types = 1); // lint >= 8.0
22

33
namespace Bug9860;
44

‎tests/PHPStan/Analyser/nsrt/bug-11703.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php declare(strict_types = 1);
2-
1+
<?php // lint >= 8.0
2+
declare(strict_types = 1);
33
namespace Bug11703;
44

55
use function PHPStan\Testing\assertType;

‎tests/PHPStan/Analyser/nsrt/bug-12125.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php declare(strict_types = 1);
2-
1+
<?php // lint >= 8.0
2+
declare(strict_types = 1);
33
namespace Bug12125;
44

55
use ArrayAccess;

‎tests/PHPStan/Analyser/nsrt/bug-13358.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php declare(strict_types = 1);
2-
1+
<?php // lint >= 8.0
2+
declare(strict_types = 1);
33
namespace Bug13358;
44

55
use function PHPStan\Testing\assertType;

‎tests/PHPStan/Analyser/nsrt/bug-14319.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php // lint >= 8.0
22

33
namespace Bug14319;
44

‎tests/PHPStan/Analyser/nsrt/bug-14710.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php declare(strict_types = 1);
2-
1+
<?php // lint >= 8.0
2+
declare(strict_types = 1);
33
namespace Bug14710;
44

55
use function PHPStan\Testing\assertType;

‎tests/PHPStan/Analyser/nsrt/bug-7259.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php declare(strict_types = 1);
2-
1+
<?php // lint >= 8.0
2+
declare(strict_types = 1);
33
namespace Bug7259;
44

55
use function PHPStan\Testing\assertType;

‎tests/PHPStan/Analyser/nsrt/bug-7987.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<?php declare(strict_types=1);
2-
1+
<?php // lint >= 8.0
2+
declare(strict_types=1);
33
namespace Bug7987;
44

55
use function PHPStan\Testing\assertType;

‎tests/PHPStan/Analyser/nsrt/bug-9208.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php // lint >= 8.0
22

33
namespace Bug9208;
44

0 commit comments

Comments
 (0)