From 86d29af6223d3ada40b235dd04ed309c3b4fb1db Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 9 Sep 2025 13:31:22 +0200 Subject: [PATCH] Added regression test --- .../Classes/ImpossibleInstanceOfRuleTest.php | 11 ++++++++ .../PHPStan/Rules/Classes/data/bug-13469.php | 25 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/PHPStan/Rules/Classes/data/bug-13469.php diff --git a/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php b/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php index f62a3e1d0d..1e7b35b352 100644 --- a/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php @@ -556,4 +556,15 @@ public function testNewIsAlwaysFinalClass(): void ]); } + public function testBug13469(): void + { + $this->treatPhpDocTypesAsCertain = false; + $this->analyse([__DIR__ . '/data/bug-13469.php'], [ + [ + 'Instanceof between Bug13469\Foo and Stringable will always evaluate to true.', + 23, + ], + ]); + } + } diff --git a/tests/PHPStan/Rules/Classes/data/bug-13469.php b/tests/PHPStan/Rules/Classes/data/bug-13469.php new file mode 100644 index 0000000000..89f73388ea --- /dev/null +++ b/tests/PHPStan/Rules/Classes/data/bug-13469.php @@ -0,0 +1,25 @@ +