From a775e375ae430dde62b7d2c2b6ac199763bf0cec Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 8 Oct 2024 09:21:56 +0200 Subject: [PATCH] put test out of global namspace --- .../Rules/Methods/CallMethodsRuleTest.php | 2 +- .../PHPStan/Rules/Methods/data/bug-11559c.php | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index 478064f39b..deeaa6abfe 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -3422,7 +3422,7 @@ public function testBug11559c(): void $this->analyse([__DIR__ . '/data/bug-11559c.php'], [ [ 'Method class@anonymous/tests/PHPStan/Rules/Methods/data/bug-11559c.php:5:1::regular_fn() invoked with 3 parameters, 1 required.', - 14, + 15, ], ]); } diff --git a/tests/PHPStan/Rules/Methods/data/bug-11559c.php b/tests/PHPStan/Rules/Methods/data/bug-11559c.php index f6a002f66b..54e3ba27b0 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-11559c.php +++ b/tests/PHPStan/Rules/Methods/data/bug-11559c.php @@ -2,13 +2,15 @@ namespace Bug11559c; -$c = new class (new class {}) { - function implicit_variadic_fn() { - $args = func_get_args(); - } - function regular_fn(int $i) { - } -}; +function doFoo() { + $c = new class (new class {}) { + function implicit_variadic_fn() { + $args = func_get_args(); + } + function regular_fn(int $i) { + } + }; -$c->implicit_variadic_fn(1, 2, 3); -$c->regular_fn(1, 2, 3); + $c->implicit_variadic_fn(1, 2, 3); + $c->regular_fn(1, 2, 3); +}