Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient]  Add missing return type #46119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Symfony/Component/HttpClient/Response/AmpResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpClient/Response/MockResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ?: [];
Expand Down Expand Up @@ -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 () {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
if (\is_resource($this->content)) {
// Empty the internal activity list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down