From 0518ae4ecfcf9a6d469fbfe0803650d4dd77c5be Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 3 Sep 2025 09:28:33 +0200 Subject: [PATCH] Add non regression tests --- .../Rules/Properties/MissingPropertyTypehintRuleTest.php | 5 +++++ .../Rules/Properties/OverridingPropertyRuleTest.php | 6 ++++++ tests/PHPStan/Rules/Properties/data/bug-11761-bis.php | 8 ++++++++ tests/PHPStan/Rules/Properties/data/bug-11761.php | 9 +++++++++ 4 files changed, 28 insertions(+) create mode 100644 tests/PHPStan/Rules/Properties/data/bug-11761-bis.php create mode 100644 tests/PHPStan/Rules/Properties/data/bug-11761.php diff --git a/tests/PHPStan/Rules/Properties/MissingPropertyTypehintRuleTest.php b/tests/PHPStan/Rules/Properties/MissingPropertyTypehintRuleTest.php index e17100bc38..c274aff53c 100644 --- a/tests/PHPStan/Rules/Properties/MissingPropertyTypehintRuleTest.php +++ b/tests/PHPStan/Rules/Properties/MissingPropertyTypehintRuleTest.php @@ -66,6 +66,11 @@ public function testBug3402(): void $this->analyse([__DIR__ . '/data/bug-3402.php'], []); } + public function testBug11761(): void + { + $this->analyse([__DIR__ . '/data/bug-11761-bis.php'], []); + } + public function testPromotedProperties(): void { $this->analyse([__DIR__ . '/data/promoted-properties-missing-typehint.php'], []); diff --git a/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php b/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php index 1384576b1d..91fed911ba 100644 --- a/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php +++ b/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php @@ -265,6 +265,12 @@ public function testBug12466(): void ]); } + public function testBug11761(): void + { + $this->reportMaybes = true; + $this->analyse([__DIR__ . '/data/bug-11761.php'], []); + } + #[RequiresPhp('>= 8.4')] public function testBug12586(): void { diff --git a/tests/PHPStan/Rules/Properties/data/bug-11761-bis.php b/tests/PHPStan/Rules/Properties/data/bug-11761-bis.php new file mode 100644 index 0000000000..f1714403f5 --- /dev/null +++ b/tests/PHPStan/Rules/Properties/data/bug-11761-bis.php @@ -0,0 +1,8 @@ +