diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index b83d3930ae0..0d53417621f 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -2218,4 +2218,16 @@ public function testBug5868(): void ]); } + public function testBug5460(): void + { + if (!self::$useStaticReflectionProvider) { + $this->markTestSkipped('Test requires static reflection.'); + } + + $this->checkThisOnly = false; + $this->checkNullables = true; + $this->checkUnionTypes = true; + $this->analyse([__DIR__ . '/data/bug-5460.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Methods/data/bug-5460.php b/tests/PHPStan/Rules/Methods/data/bug-5460.php new file mode 100644 index 00000000000..d4c041649f0 --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-5460.php @@ -0,0 +1,15 @@ +setOptions(["timeout" => 1]); + + $request->getBody()->append(""); + + $client = new \http\Client(); + $client->enqueue($request)->send(); + + $response = $client->getResponse($request); +};