From 2daae4655ca88723a087a64340f40b79f24a76e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Wed, 20 Apr 2022 08:22:07 +0200 Subject: [PATCH] Add missing return type to HttpClient --- src/Symfony/Component/HttpClient/Response/AmpResponse.php | 6 +++--- src/Symfony/Component/HttpClient/Response/MockResponse.php | 4 ++-- src/Symfony/Component/HttpClient/Response/StreamWrapper.php | 2 +- .../Component/HttpClient/Response/TraceableResponse.php | 2 +- .../HttpClient/Response/TransportResponseTrait.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/HttpClient/Response/AmpResponse.php b/src/Symfony/Component/HttpClient/Response/AmpResponse.php index b8dff00a551bb..7ab4ec5c11c90 100644 --- a/src/Symfony/Component/HttpClient/Response/AmpResponse.php +++ b/src/Symfony/Component/HttpClient/Response/AmpResponse.php @@ -226,7 +226,7 @@ private static function select(ClientState $multi, float $timeout): int return null === self::$delay ? 1 : 0; } - private static function generateResponse(Request $request, AmpClientState $multi, string $id, array &$info, array &$headers, CancellationTokenSource $canceller, array &$options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause) + private static function generateResponse(Request $request, AmpClientState $multi, string $id, array &$info, array &$headers, CancellationTokenSource $canceller, array &$options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause): \Generator { $request->setInformationalResponseHandler(static function (Response $response) use ($multi, $id, &$info, &$headers) { self::addResponseHeaders($response, $info, $headers); @@ -285,7 +285,7 @@ private static function generateResponse(Request $request, AmpClientState $multi self::stopLoop(); } - private static function followRedirects(Request $originRequest, AmpClientState $multi, array &$info, array &$headers, CancellationTokenSource $canceller, array $options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause) + private static function followRedirects(Request $originRequest, AmpClientState $multi, array &$info, array &$headers, CancellationTokenSource $canceller, array $options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause): \Generator { yield $pause; @@ -399,7 +399,7 @@ private static function addResponseHeaders(Response $response, array &$info, arr /** * Accepts pushed responses only if their headers related to authentication match the request. */ - private static function getPushedResponse(Request $request, AmpClientState $multi, array &$info, array &$headers, array $options, ?LoggerInterface $logger) + private static function getPushedResponse(Request $request, AmpClientState $multi, array &$info, array &$headers, array $options, ?LoggerInterface $logger): \Generator { if ('' !== $options['body']) { return null; diff --git a/src/Symfony/Component/HttpClient/Response/MockResponse.php b/src/Symfony/Component/HttpClient/Response/MockResponse.php index d143de2aa006b..9b80f310e8f13 100644 --- a/src/Symfony/Component/HttpClient/Response/MockResponse.php +++ b/src/Symfony/Component/HttpClient/Response/MockResponse.php @@ -229,7 +229,7 @@ protected static function select(ClientState $multi, float $timeout): int /** * Simulates sending the request. */ - private static function writeRequest(self $response, array $options, ResponseInterface $mock) + private static function writeRequest(self $response, array $options, ResponseInterface $mock): void { $onProgress = $options['on_progress'] ?? static function () {}; $response->info += $mock->getInfo() ?: []; @@ -272,7 +272,7 @@ private static function writeRequest(self $response, array $options, ResponseInt /** * Simulates reading the response. */ - private static function readResponse(self $response, array $options, ResponseInterface $mock, int &$offset) + private static function readResponse(self $response, array $options, ResponseInterface $mock, int &$offset): void { $onProgress = $options['on_progress'] ?? static function () {}; diff --git a/src/Symfony/Component/HttpClient/Response/StreamWrapper.php b/src/Symfony/Component/HttpClient/Response/StreamWrapper.php index 9879c78d26acc..e002a004816d6 100644 --- a/src/Symfony/Component/HttpClient/Response/StreamWrapper.php +++ b/src/Symfony/Component/HttpClient/Response/StreamWrapper.php @@ -117,7 +117,7 @@ public function stream_open(string $path, string $mode, int $options): bool return false; } - public function stream_read(int $count) + public function stream_read(int $count): string|false { if (\is_resource($this->content)) { // Empty the internal activity list diff --git a/src/Symfony/Component/HttpClient/Response/TraceableResponse.php b/src/Symfony/Component/HttpClient/Response/TraceableResponse.php index 4d665f4d8c7f4..507799e1428ab 100644 --- a/src/Symfony/Component/HttpClient/Response/TraceableResponse.php +++ b/src/Symfony/Component/HttpClient/Response/TraceableResponse.php @@ -202,7 +202,7 @@ public static function stream(HttpClientInterface $client, iterable $responses, } } - private function checkStatusCode(int $code) + private function checkStatusCode(int $code): void { if (500 <= $code) { throw new ServerException($this); diff --git a/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php b/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php index c639eb9fcd1c6..f2615111bc97a 100644 --- a/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php +++ b/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php @@ -131,7 +131,7 @@ private static function addResponseHeaders(array $responseHeaders, array &$info, /** * Ensures the request is always sent and that the response code was checked. */ - private function doDestruct() + private function doDestruct(): void { $this->shouldBuffer = true;