diff --git a/build/PHPStan/Build/RequiredPhpVersionVisitor.php b/build/PHPStan/Build/RequiredPhpVersionVisitor.php index 3103d6f725..9af2e885a4 100644 --- a/build/PHPStan/Build/RequiredPhpVersionVisitor.php +++ b/build/PHPStan/Build/RequiredPhpVersionVisitor.php @@ -67,6 +67,7 @@ public function enterNode(Node $node): ?Node } if ($node instanceof Node\UnionType) { + $this->require(self::PHP_8_0, 'union types', $node); foreach ($node->types as $innerType) { if ($innerType instanceof Node\IntersectionType) { $this->require(self::PHP_8_2, 'disjunctive normal form types', $innerType); diff --git a/tests/PHPStan/Analyser/data/bug-9860.php b/tests/PHPStan/Analyser/data/bug-9860.php index d3702fed7a..1853527ed6 100644 --- a/tests/PHPStan/Analyser/data/bug-9860.php +++ b/tests/PHPStan/Analyser/data/bug-9860.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9860; diff --git a/tests/PHPStan/Analyser/nsrt/bug-11703.php b/tests/PHPStan/Analyser/nsrt/bug-11703.php index ae1a91127b..ec2f07fbcf 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-11703.php +++ b/tests/PHPStan/Analyser/nsrt/bug-11703.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug11703; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-12125.php b/tests/PHPStan/Analyser/nsrt/bug-12125.php index 815e3cb701..c7dc37ad9c 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-12125.php +++ b/tests/PHPStan/Analyser/nsrt/bug-12125.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug12125; use ArrayAccess; diff --git a/tests/PHPStan/Analyser/nsrt/bug-13358.php b/tests/PHPStan/Analyser/nsrt/bug-13358.php index 43cdeeca2f..6482ddca2d 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-13358.php +++ b/tests/PHPStan/Analyser/nsrt/bug-13358.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug13358; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-14319.php b/tests/PHPStan/Analyser/nsrt/bug-14319.php index cbf89d13dc..c253aa5cdc 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-14319.php +++ b/tests/PHPStan/Analyser/nsrt/bug-14319.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug14319; diff --git a/tests/PHPStan/Analyser/nsrt/bug-14710.php b/tests/PHPStan/Analyser/nsrt/bug-14710.php index 6d208e77ca..711580f536 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-14710.php +++ b/tests/PHPStan/Analyser/nsrt/bug-14710.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug14710; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-7259.php b/tests/PHPStan/Analyser/nsrt/bug-7259.php index df6eb0aaf4..571e61f009 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-7259.php +++ b/tests/PHPStan/Analyser/nsrt/bug-7259.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug7259; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-7987.php b/tests/PHPStan/Analyser/nsrt/bug-7987.php index 23bda9fb31..ed7a2a8609 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-7987.php +++ b/tests/PHPStan/Analyser/nsrt/bug-7987.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types=1); namespace Bug7987; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-9208.php b/tests/PHPStan/Analyser/nsrt/bug-9208.php index fa9ec21a30..923c7e7ba4 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-9208.php +++ b/tests/PHPStan/Analyser/nsrt/bug-9208.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9208; diff --git a/tests/PHPStan/Analyser/nsrt/bug-9360.php b/tests/PHPStan/Analyser/nsrt/bug-9360.php index 668affdb43..1c1b667fab 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-9360.php +++ b/tests/PHPStan/Analyser/nsrt/bug-9360.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug9360; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-9404.php b/tests/PHPStan/Analyser/nsrt/bug-9404.php index e03c4cd386..232648aa8f 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-9404.php +++ b/tests/PHPStan/Analyser/nsrt/bug-9404.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9404; diff --git a/tests/PHPStan/Analyser/nsrt/date-format.php b/tests/PHPStan/Analyser/nsrt/date-format.php index 2f11a33471..e01319f280 100644 --- a/tests/PHPStan/Analyser/nsrt/date-format.php +++ b/tests/PHPStan/Analyser/nsrt/date-format.php @@ -1,4 +1,4 @@ -= 8.0 namespace DateFormatReturnType; diff --git a/tests/PHPStan/Analyser/nsrt/native-expressions.php b/tests/PHPStan/Analyser/nsrt/native-expressions.php index abe041686a..9af55763dd 100644 --- a/tests/PHPStan/Analyser/nsrt/native-expressions.php +++ b/tests/PHPStan/Analyser/nsrt/native-expressions.php @@ -1,4 +1,4 @@ -= 8.0 namespace NativeExpressions; diff --git a/tests/PHPStan/Analyser/nsrt/preg_split.php b/tests/PHPStan/Analyser/nsrt/preg_split.php index 210a467372..5980f4ad12 100644 --- a/tests/PHPStan/Analyser/nsrt/preg_split.php +++ b/tests/PHPStan/Analyser/nsrt/preg_split.php @@ -1,4 +1,4 @@ -= 8.0 namespace PregSplit; diff --git a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php index 5af1af0dc0..9adde3a4c3 100644 --- a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php +++ b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php @@ -123,6 +123,9 @@ public static function dataDetectedVersion(): iterable yield 'enum' => [' [' [' [' [' [' [' [' ['= 8.0 namespace Bug5760; diff --git a/tests/PHPStan/Rules/Functions/data/bug-6448.php b/tests/PHPStan/Rules/Functions/data/bug-6448.php index c2529c8713..d08399fcad 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-6448.php +++ b/tests/PHPStan/Rules/Functions/data/bug-6448.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug6448; diff --git a/tests/PHPStan/Rules/Functions/data/bug-7138.php b/tests/PHPStan/Rules/Functions/data/bug-7138.php index 28b6db70cf..ed10202d70 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-7138.php +++ b/tests/PHPStan/Rules/Functions/data/bug-7138.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug7138; diff --git a/tests/PHPStan/Rules/Functions/data/bug-9652.php b/tests/PHPStan/Rules/Functions/data/bug-9652.php index fa0c827443..2023c94144 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-9652.php +++ b/tests/PHPStan/Rules/Functions/data/bug-9652.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9652; diff --git a/tests/PHPStan/Rules/Methods/data/bug-11663.php b/tests/PHPStan/Rules/Methods/data/bug-11663.php index ac2ed03a93..f21aa5f0cc 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-11663.php +++ b/tests/PHPStan/Rules/Methods/data/bug-11663.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug11663; diff --git a/tests/PHPStan/Rules/Methods/data/bug-12558.php b/tests/PHPStan/Rules/Methods/data/bug-12558.php index 88a8224924..c501c4137d 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-12558.php +++ b/tests/PHPStan/Rules/Methods/data/bug-12558.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug12558; diff --git a/tests/PHPStan/Rules/Methods/data/bug-12884.php b/tests/PHPStan/Rules/Methods/data/bug-12884.php index 20ec2cac5f..4955bd0f77 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-12884.php +++ b/tests/PHPStan/Rules/Methods/data/bug-12884.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug12884; diff --git a/tests/PHPStan/Rules/Methods/data/bug-14617.php b/tests/PHPStan/Rules/Methods/data/bug-14617.php index d8e81076d4..0ad5533fc0 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-14617.php +++ b/tests/PHPStan/Rules/Methods/data/bug-14617.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug14617; diff --git a/tests/PHPStan/Rules/Methods/data/bug-8071.php b/tests/PHPStan/Rules/Methods/data/bug-8071.php index 2acbb838ca..60793d5fa5 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-8071.php +++ b/tests/PHPStan/Rules/Methods/data/bug-8071.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug8071; diff --git a/tests/PHPStan/Rules/Properties/data/invalid-callable-property-type.php b/tests/PHPStan/Rules/Properties/data/invalid-callable-property-type.php index 053c0bfb1c..8deca5ff92 100644 --- a/tests/PHPStan/Rules/Properties/data/invalid-callable-property-type.php +++ b/tests/PHPStan/Rules/Properties/data/invalid-callable-property-type.php @@ -1,4 +1,4 @@ -= 8.0 namespace InvalidCallablePropertyType; diff --git a/tests/PHPStan/Rules/Types/data/invalid-union-with-never.php b/tests/PHPStan/Rules/Types/data/invalid-union-with-never.php index d959067f89..00103eceaf 100644 --- a/tests/PHPStan/Rules/Types/data/invalid-union-with-never.php +++ b/tests/PHPStan/Rules/Types/data/invalid-union-with-never.php @@ -1,4 +1,4 @@ -= 8.0 namespace InvalidUnionWithNever; diff --git a/tests/PHPStan/Rules/Types/data/invalid-union-with-void.php b/tests/PHPStan/Rules/Types/data/invalid-union-with-void.php index 8744da8a10..fee0b54ffa 100644 --- a/tests/PHPStan/Rules/Types/data/invalid-union-with-void.php +++ b/tests/PHPStan/Rules/Types/data/invalid-union-with-void.php @@ -1,4 +1,4 @@ -= 8.0 namespace InvalidUnionWithVoid;