diff --git a/build/PHPStan/Build/RequiredPhpVersionVisitor.php b/build/PHPStan/Build/RequiredPhpVersionVisitor.php index 9af2e885a4..3ba7ed0563 100644 --- a/build/PHPStan/Build/RequiredPhpVersionVisitor.php +++ b/build/PHPStan/Build/RequiredPhpVersionVisitor.php @@ -88,6 +88,10 @@ public function enterNode(Node $node): ?Node $this->require(self::PHP_8_1, 'readonly properties', $node); } + if ($node instanceof Node\Param && $node->flags !== 0) { + $this->require(self::PHP_8_0, 'promoted properties', $node); + } + if ($node instanceof Node\Param && ($node->flags & Modifiers::READONLY) !== 0) { $this->require(self::PHP_8_1, 'readonly promoted properties', $node); } diff --git a/tests/PHPStan/Analyser/data/bug-7116.php b/tests/PHPStan/Analyser/data/bug-7116.php index c25688f2bb..c0dcf33a70 100644 --- a/tests/PHPStan/Analyser/data/bug-7116.php +++ b/tests/PHPStan/Analyser/data/bug-7116.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug7116; #[\Attribute(\Attribute::TARGET_CLASS)] diff --git a/tests/PHPStan/Analyser/nsrt/assert-constructor.php b/tests/PHPStan/Analyser/nsrt/assert-constructor.php index 2d133d8c6c..fe70ef56d3 100644 --- a/tests/PHPStan/Analyser/nsrt/assert-constructor.php +++ b/tests/PHPStan/Analyser/nsrt/assert-constructor.php @@ -1,4 +1,4 @@ -= 8.0 namespace AssertConstructor; diff --git a/tests/PHPStan/Analyser/nsrt/assert-this.php b/tests/PHPStan/Analyser/nsrt/assert-this.php index 4b29fa697c..6a31e1578e 100644 --- a/tests/PHPStan/Analyser/nsrt/assert-this.php +++ b/tests/PHPStan/Analyser/nsrt/assert-this.php @@ -1,4 +1,4 @@ -= 8.0 namespace AssertThis; diff --git a/tests/PHPStan/Analyser/nsrt/bug-13851.php b/tests/PHPStan/Analyser/nsrt/bug-13851.php index 74480f368a..63358ad4d2 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-13851.php +++ b/tests/PHPStan/Analyser/nsrt/bug-13851.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types=1); namespace Bug13851; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-14645.php b/tests/PHPStan/Analyser/nsrt/bug-14645.php index 459fcedb79..c9f9994348 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-14645.php +++ b/tests/PHPStan/Analyser/nsrt/bug-14645.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug14645; diff --git a/tests/PHPStan/Analyser/nsrt/bug-6633.php b/tests/PHPStan/Analyser/nsrt/bug-6633.php index 3689f53ee9..b5c6daf959 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-6633.php +++ b/tests/PHPStan/Analyser/nsrt/bug-6633.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug6633; use function PHPStan\Testing\assertType; diff --git a/tests/PHPStan/Analyser/nsrt/bug-8008.php b/tests/PHPStan/Analyser/nsrt/bug-8008.php index d3e8ae63d4..e3c238e6e9 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-8008.php +++ b/tests/PHPStan/Analyser/nsrt/bug-8008.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug8008; diff --git a/tests/PHPStan/Analyser/nsrt/bug-9455.php b/tests/PHPStan/Analyser/nsrt/bug-9455.php index b3688b8b91..d14ecd969f 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-9455.php +++ b/tests/PHPStan/Analyser/nsrt/bug-9455.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9455; diff --git a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php index 9adde3a4c3..16a8eb2684 100644 --- a/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php +++ b/tests/PHPStan/Build/RequiredPhpVersionCommentTest.php @@ -122,6 +122,10 @@ public static function dataDetectedVersion(): iterable yield 'mixed property type' => [' [' [' [' [' [' [' [' [' ['= 8.0 namespace InstantiationPromotedProperties; diff --git a/tests/PHPStan/Rules/Classes/data/invalid-promoted-properties.php b/tests/PHPStan/Rules/Classes/data/invalid-promoted-properties.php index b28c29a53e..aa027e8daf 100644 --- a/tests/PHPStan/Rules/Classes/data/invalid-promoted-properties.php +++ b/tests/PHPStan/Rules/Classes/data/invalid-promoted-properties.php @@ -1,4 +1,4 @@ -= 8.0 namespace InvalidPromotedProperties; diff --git a/tests/PHPStan/Rules/Functions/data/bug-10298.php b/tests/PHPStan/Rules/Functions/data/bug-10298.php index dfbfa7979e..4cc2f1b1ff 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-10298.php +++ b/tests/PHPStan/Rules/Functions/data/bug-10298.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug10298; #[\Attribute(\Attribute::TARGET_PROPERTY)] diff --git a/tests/PHPStan/Rules/Functions/data/bug-10732.php b/tests/PHPStan/Rules/Functions/data/bug-10732.php index daabd2c88a..9d4f3bd584 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-10732.php +++ b/tests/PHPStan/Rules/Functions/data/bug-10732.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug10732; diff --git a/tests/PHPStan/Rules/Functions/data/bug-12317.php b/tests/PHPStan/Rules/Functions/data/bug-12317.php index 2443fefc09..53aaed158a 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-12317.php +++ b/tests/PHPStan/Rules/Functions/data/bug-12317.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug12317; class Uuid { diff --git a/tests/PHPStan/Rules/Functions/data/bug-12499.php b/tests/PHPStan/Rules/Functions/data/bug-12499.php index 1322e06e4f..7dea47dfc9 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-12499.php +++ b/tests/PHPStan/Rules/Functions/data/bug-12499.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug12499; diff --git a/tests/PHPStan/Rules/Functions/data/bug-6633.php b/tests/PHPStan/Rules/Functions/data/bug-6633.php index 31bc3cf7d8..989c6a8f85 100644 --- a/tests/PHPStan/Rules/Functions/data/bug-6633.php +++ b/tests/PHPStan/Rules/Functions/data/bug-6633.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug6633\Rule; class CreateServiceSolrData diff --git a/tests/PHPStan/Rules/Functions/data/param-attributes.php b/tests/PHPStan/Rules/Functions/data/param-attributes.php index 39231f293e..9c2207c4b3 100644 --- a/tests/PHPStan/Rules/Functions/data/param-attributes.php +++ b/tests/PHPStan/Rules/Functions/data/param-attributes.php @@ -1,4 +1,4 @@ -= 8.0 namespace ParamAttributes; diff --git a/tests/PHPStan/Rules/Methods/data/bug-11067.php b/tests/PHPStan/Rules/Methods/data/bug-11067.php index 7245f5feca..2ff8febed2 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-11067.php +++ b/tests/PHPStan/Rules/Methods/data/bug-11067.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug11067; interface BuilderInterface diff --git a/tests/PHPStan/Rules/Methods/data/bug-13511.php b/tests/PHPStan/Rules/Methods/data/bug-13511.php index cf7efde5be..a889aaefb4 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-13511.php +++ b/tests/PHPStan/Rules/Methods/data/bug-13511.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug13511; diff --git a/tests/PHPStan/Rules/Methods/data/bug-13993.php b/tests/PHPStan/Rules/Methods/data/bug-13993.php index d9847a9686..78b3222c5d 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-13993.php +++ b/tests/PHPStan/Rules/Methods/data/bug-13993.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug13993; diff --git a/tests/PHPStan/Rules/Methods/data/bug-6353.php b/tests/PHPStan/Rules/Methods/data/bug-6353.php index f9542a4c15..ef4d33a742 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-6353.php +++ b/tests/PHPStan/Rules/Methods/data/bug-6353.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug6353; diff --git a/tests/PHPStan/Rules/Methods/data/bug-7662.php b/tests/PHPStan/Rules/Methods/data/bug-7662.php index 826ba3fe84..f9bfe7870f 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-7662.php +++ b/tests/PHPStan/Rules/Methods/data/bug-7662.php @@ -1,5 +1,5 @@ -= 8.0 +declare(strict_types = 1); namespace Bug7662; class Foo { diff --git a/tests/PHPStan/Rules/Methods/data/bug-9494.php b/tests/PHPStan/Rules/Methods/data/bug-9494.php index 3e9146ab6b..bd8f5dd56a 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-9494.php +++ b/tests/PHPStan/Rules/Methods/data/bug-9494.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9494; diff --git a/tests/PHPStan/Rules/Methods/data/bug-9766.php b/tests/PHPStan/Rules/Methods/data/bug-9766.php index 2be59b73dc..5413ee62f1 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-9766.php +++ b/tests/PHPStan/Rules/Methods/data/bug-9766.php @@ -1,4 +1,4 @@ -= 8.0 namespace Bug9766; diff --git a/tests/PHPStan/Rules/Methods/data/reflection-class-issue-8679.php b/tests/PHPStan/Rules/Methods/data/reflection-class-issue-8679.php index 32c3937b52..99c5fb2783 100644 --- a/tests/PHPStan/Rules/Methods/data/reflection-class-issue-8679.php +++ b/tests/PHPStan/Rules/Methods/data/reflection-class-issue-8679.php @@ -1,4 +1,4 @@ -= 8.0 namespace ReflectionClassIssue8679;