From ae15b316560c97943ec173f513812a77dedc32a0 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 29 Jul 2025 14:20:21 +0200 Subject: [PATCH 1/2] Add non regression test for 13267 --- .../Rules/Methods/CallMethodsRuleTest.php | 10 ++++++++++ tests/PHPStan/Rules/Methods/data/bug-13267.php | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/PHPStan/Rules/Methods/data/bug-13267.php diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index 0a78d5dfd5..944ef5ebc1 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -3646,6 +3646,16 @@ public function testBug5642(): void ]); } + public function testBug13267(): void + { + $this->checkThisOnly = false; + $this->checkNullables = false; + $this->checkUnionTypes = true; + $this->checkExplicitMixed = false; + + $this->analyse([__DIR__ . '/data/bug-13267.php'], []); + } + public function testBug3396(): void { $this->checkThisOnly = false; diff --git a/tests/PHPStan/Rules/Methods/data/bug-13267.php b/tests/PHPStan/Rules/Methods/data/bug-13267.php new file mode 100644 index 0000000000..f49948300e --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-13267.php @@ -0,0 +1,16 @@ +getMessage(), + $e->getCode(), + 1, + $e->getFile(), + $e->getLine(), + $e->getPrevious(), + ); + } +} From 78e616ad8d7bf7fe719fe32d6784d582001bf5a0 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 30 Aug 2025 16:52:18 +0200 Subject: [PATCH 2/2] Move test --- tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php | 10 ---------- .../Rules/Methods/CallStaticMethodsRuleTest.php | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index 944ef5ebc1..0a78d5dfd5 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -3646,16 +3646,6 @@ public function testBug5642(): void ]); } - public function testBug13267(): void - { - $this->checkThisOnly = false; - $this->checkNullables = false; - $this->checkUnionTypes = true; - $this->checkExplicitMixed = false; - - $this->analyse([__DIR__ . '/data/bug-13267.php'], []); - } - public function testBug3396(): void { $this->checkThisOnly = false; diff --git a/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php index 282415af6f..bd53eca6e0 100644 --- a/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php @@ -885,6 +885,14 @@ public function testDynamicCall(): void ]); } + public function testBug13267(): void + { + $this->checkThisOnly = false; + $this->checkExplicitMixed = false; + + $this->analyse([__DIR__ . '/data/bug-13267.php'], []); + } + public function testRestrictedInternalClassNameUsage(): void { $this->checkThisOnly = false;