Skip to content

Commit 31b91ff

Browse files
Merge branch '7.0' into 7.1
* 7.0: List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters minor #53524 [Messenger] [AmazonSqs] Allow `async-aws/sqs` version 2 (smoench) Fix bad merge List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters List CS fix in .git-blame-ignore-revs Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value [Messenger][AmazonSqs] Allow async-aws/sqs version 2
2 parents df77819 + dc4ee0b commit 31b91ff

32 files changed

+55
-55
lines changed

AmpHttpClient.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class AmpHttpClient implements HttpClientInterface, LoggerAwareInterface,
6464
*
6565
* @see HttpClientInterface::OPTIONS_DEFAULTS for available options
6666
*/
67-
public function __construct(array $defaultOptions = [], callable $clientConfigurator = null, int $maxHostConnections = 6, int $maxPendingPushes = 50)
67+
public function __construct(array $defaultOptions = [], ?callable $clientConfigurator = null, int $maxHostConnections = 6, int $maxPendingPushes = 50)
6868
{
6969
$this->defaultOptions['buffer'] ??= self::shouldBuffer(...);
7070

@@ -148,7 +148,7 @@ public function request(string $method, string $url, array $options = []): Respo
148148
return new AmpResponse($this->multi, $request, $options, $this->logger);
149149
}
150150

151-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
151+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
152152
{
153153
if ($responses instanceof AmpResponse) {
154154
$responses = [$responses];

AsyncDecoratorTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ trait AsyncDecoratorTrait
3030
*/
3131
abstract public function request(string $method, string $url, array $options = []): ResponseInterface;
3232

33-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
33+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
3434
{
3535
if ($responses instanceof AsyncResponse) {
3636
$responses = [$responses];

CachingHttpClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function request(string $method, string $url, array $options = []): Respo
105105
return MockResponse::fromRequest($method, $url, $options, $response);
106106
}
107107

108-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
108+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
109109
{
110110
if ($responses instanceof ResponseInterface) {
111111
$responses = [$responses];

Chunk/ErrorChunk.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getError(): ?string
8383
return $this->errorMessage;
8484
}
8585

86-
public function didThrow(bool $didThrow = null): bool
86+
public function didThrow(?bool $didThrow = null): bool
8787
{
8888
if (null !== $didThrow && $this->didThrow !== $didThrow) {
8989
return !$this->didThrow = $didThrow;

CurlHttpClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public function request(string $method, string $url, array $options = []): Respo
317317
return $pushedResponse ?? new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host, $port), CurlClientState::$curlVersion['version_number'], $url);
318318
}
319319

320-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
320+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
321321
{
322322
if ($responses instanceof CurlResponse) {
323323
$responses = [$responses];

DataCollector/HttpClientDataCollector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function registerClient(string $name, TraceableHttpClient $client): void
3838
$this->clients[$name] = $client;
3939
}
4040

41-
public function collect(Request $request, Response $response, \Throwable $exception = null): void
41+
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
4242
{
4343
$this->lateCollect();
4444
}

DecoratorTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trait DecoratorTrait
2525
{
2626
private HttpClientInterface $client;
2727

28-
public function __construct(HttpClientInterface $client = null)
28+
public function __construct(?HttpClientInterface $client = null)
2929
{
3030
$this->client = $client ?? HttpClient::create();
3131
}
@@ -35,7 +35,7 @@ public function request(string $method, string $url, array $options = []): Respo
3535
return $this->client->request($method, $url, $options);
3636
}
3737

38-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
38+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
3939
{
4040
return $this->client->stream($responses, $timeout);
4141
}

EventSourceHttpClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class EventSourceHttpClient implements HttpClientInterface, ResetInterface
3333

3434
private float $reconnectionTime;
3535

36-
public function __construct(HttpClientInterface $client = null, float $reconnectionTime = 10.0)
36+
public function __construct(?HttpClientInterface $client = null, float $reconnectionTime = 10.0)
3737
{
3838
$this->client = $client ?? HttpClient::create();
3939
$this->reconnectionTime = $reconnectionTime;

HttpClientTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ private static function normalizePeerFingerprint(mixed $fingerprint): array
535535
/**
536536
* @throws InvalidArgumentException When the value cannot be json-encoded
537537
*/
538-
private static function jsonEncode(mixed $value, int $flags = null, int $maxDepth = 512): string
538+
private static function jsonEncode(mixed $value, ?int $flags = null, int $maxDepth = 512): string
539539
{
540540
$flags ??= \JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_PRESERVE_ZERO_FRACTION;
541541

HttplugClient.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ final class HttplugClient implements ClientInterface, HttpAsyncClient, RequestFa
6969

7070
private HttplugWaitLoop $waitLoop;
7171

72-
public function __construct(HttpClientInterface $client = null, ResponseFactoryInterface $responseFactory = null, StreamFactoryInterface $streamFactory = null)
72+
public function __construct(?HttpClientInterface $client = null, ?ResponseFactoryInterface $responseFactory = null, ?StreamFactoryInterface $streamFactory = null)
7373
{
7474
$this->client = $client ?? HttpClient::create();
7575
$streamFactory ??= $responseFactory instanceof StreamFactoryInterface ? $responseFactory : null;
@@ -143,7 +143,7 @@ public function sendAsyncRequest(RequestInterface $request): HttplugPromise
143143
*
144144
* @return int The number of remaining pending promises
145145
*/
146-
public function wait(float $maxDuration = null, float $idleTimeout = null): int
146+
public function wait(?float $maxDuration = null, ?float $idleTimeout = null): int
147147
{
148148
return $this->waitLoop->wait(null, $maxDuration, $idleTimeout);
149149
}
@@ -220,7 +220,7 @@ public function reset(): void
220220
}
221221
}
222222

223-
private function sendPsr7Request(RequestInterface $request, bool $buffer = null): ResponseInterface
223+
private function sendPsr7Request(RequestInterface $request, ?bool $buffer = null): ResponseInterface
224224
{
225225
try {
226226
$body = $request->getBody();

Internal/AmpClientState.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private function getClient(array $options): array
147147
/** @var resource|null */
148148
public $handle;
149149

150-
public function connect(string $uri, ConnectContext $context = null, CancellationToken $token = null): Promise
150+
public function connect(string $uri, ?ConnectContext $context = null, ?CancellationToken $token = null): Promise
151151
{
152152
$result = $this->connector->connect($this->uri ?? $uri, $context, $token);
153153
$result->onResolve(function ($e, $socket) {

Internal/AmpResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
) {
3131
}
3232

33-
public function resolve(string $name, int $typeRestriction = null): Promise
33+
public function resolve(string $name, ?int $typeRestriction = null): Promise
3434
{
3535
if (!isset($this->dnsMap[$name]) || !\in_array($typeRestriction, [Record::A, null], true)) {
3636
return Dns\resolver()->resolve($name, $typeRestriction);

Internal/HttplugWaitLoop.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
) {
4242
}
4343

44-
public function wait(?ResponseInterface $pendingResponse, float $maxDuration = null, float $idleTimeout = null): int
44+
public function wait(?ResponseInterface $pendingResponse, ?float $maxDuration = null, ?float $idleTimeout = null): int
4545
{
4646
if (!$this->promisePool) {
4747
return 0;

MockHttpClient.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MockHttpClient implements HttpClientInterface, ResetInterface
3535
/**
3636
* @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory
3737
*/
38-
public function __construct(callable|iterable|ResponseInterface $responseFactory = null, ?string $baseUri = 'https://example.com')
38+
public function __construct(callable|iterable|ResponseInterface|null $responseFactory = null, ?string $baseUri = 'https://example.com')
3939
{
4040
$this->setResponseFactory($responseFactory);
4141
$this->defaultOptions['base_uri'] = $baseUri;
@@ -84,7 +84,7 @@ public function request(string $method, string $url, array $options = []): Respo
8484
return MockResponse::fromRequest($method, $url, $options, $response);
8585
}
8686

87-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
87+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
8888
{
8989
if ($responses instanceof ResponseInterface) {
9090
$responses = [$responses];

NativeHttpClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function request(string $method, string $url, array $options = []): Respo
269269
return new NativeResponse($this->multi, $context, implode('', $url), $options, $info, $resolver, $onProgress, $this->logger);
270270
}
271271

272-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
272+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
273273
{
274274
if ($responses instanceof NativeResponse) {
275275
$responses = [$responses];

NoPrivateNetworkHttpClient.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
3737
* @param string|array|null $subnets String or array of subnets using CIDR notation that will be used by IpUtils.
3838
* If null is passed, the standard private subnets will be used.
3939
*/
40-
public function __construct(HttpClientInterface $client, string|array $subnets = null)
40+
public function __construct(HttpClientInterface $client, string|array|null $subnets = null)
4141
{
4242
if (!class_exists(IpUtils::class)) {
4343
throw new \LogicException(sprintf('You cannot use "%s" if the HttpFoundation component is not installed. Try running "composer require symfony/http-foundation".', __CLASS__));
@@ -72,7 +72,7 @@ public function request(string $method, string $url, array $options = []): Respo
7272
return $this->client->request($method, $url, $options);
7373
}
7474

75-
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
75+
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
7676
{
7777
return $this->client->stream($responses, $timeout);
7878
}

Psr18Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class Psr18Client implements ClientInterface, RequestFactoryInterface, Str
5454
private ResponseFactoryInterface $responseFactory;
5555
private StreamFactoryInterface $streamFactory;
5656

57-
public function __construct(HttpClientInterface $client = null, ResponseFactoryInterface $responseFactory = null, StreamFactoryInterface $streamFactory = null)
57+
public function __construct(?HttpClientInterface $client = null, ?ResponseFactoryInterface $responseFactory = null, ?StreamFactoryInterface $streamFactory = null)
5858
{
5959
$this->client = $client ?? HttpClient::create();
6060
$streamFactory ??= $responseFactory instanceof StreamFactoryInterface ? $responseFactory : null;

Response/AmpResponse.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function __construct(
136136
});
137137
}
138138

139-
public function getInfo(string $type = null): mixed
139+
public function getInfo(?string $type = null): mixed
140140
{
141141
return null !== $type ? $this->info[$type] ?? null : $this->info;
142142
}
@@ -181,7 +181,7 @@ private static function schedule(self $response, array &$runningResponses): void
181181
/**
182182
* @param AmpClientState $multi
183183
*/
184-
private static function perform(ClientState $multi, array &$responses = null): void
184+
private static function perform(ClientState $multi, ?array &$responses = null): void
185185
{
186186
if ($responses) {
187187
foreach ($responses as $response) {

Response/AsyncContext.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function cancel(): ChunkInterface
116116
/**
117117
* Returns the current info of the response.
118118
*/
119-
public function getInfo(string $type = null): mixed
119+
public function getInfo(?string $type = null): mixed
120120
{
121121
if (null !== $type) {
122122
return $this->info[$type] ?? $this->response->getInfo($type);
@@ -189,7 +189,7 @@ public function replaceResponse(ResponseInterface $response): ResponseInterface
189189
*
190190
* @param ?callable(ChunkInterface, self): ?\Iterator $passthru
191191
*/
192-
public function passthru(callable $passthru = null): void
192+
public function passthru(?callable $passthru = null): void
193193
{
194194
$this->passthru = $passthru ?? static function ($chunk, $context) {
195195
$context->passthru = null;

Response/AsyncResponse.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
4545
/**
4646
* @param ?callable(ChunkInterface, AsyncContext): ?\Iterator $passthru
4747
*/
48-
public function __construct(HttpClientInterface $client, string $method, string $url, array $options, callable $passthru = null)
48+
public function __construct(HttpClientInterface $client, string $method, string $url, array $options, ?callable $passthru = null)
4949
{
5050
$this->client = $client;
5151
$this->shouldBuffer = $options['buffer'] ?? true;
@@ -58,7 +58,7 @@ public function __construct(HttpClientInterface $client, string $method, string
5858
}
5959
$this->response = $client->request($method, $url, ['buffer' => false] + $options);
6060
$this->passthru = $passthru;
61-
$this->initializer = static function (self $response, float $timeout = null) {
61+
$this->initializer = static function (self $response, ?float $timeout = null) {
6262
if (null === $response->shouldBuffer) {
6363
return false;
6464
}
@@ -115,7 +115,7 @@ public function getHeaders(bool $throw = true): array
115115
return $headers;
116116
}
117117

118-
public function getInfo(string $type = null): mixed
118+
public function getInfo(?string $type = null): mixed
119119
{
120120
if (null !== $type) {
121121
return $this->info[$type] ?? $this->response->getInfo($type);
@@ -207,7 +207,7 @@ public function __destruct()
207207
/**
208208
* @internal
209209
*/
210-
public static function stream(iterable $responses, float $timeout = null, string $class = null): \Generator
210+
public static function stream(iterable $responses, ?float $timeout = null, ?string $class = null): \Generator
211211
{
212212
while ($responses) {
213213
$wrappedResponses = [];
@@ -315,7 +315,7 @@ public static function stream(iterable $responses, float $timeout = null, string
315315
/**
316316
* @param \SplObjectStorage<ResponseInterface, AsyncResponse>|null $asyncMap
317317
*/
318-
private static function passthru(HttpClientInterface $client, self $r, ChunkInterface $chunk, \SplObjectStorage $asyncMap = null): \Generator
318+
private static function passthru(HttpClientInterface $client, self $r, ChunkInterface $chunk, ?\SplObjectStorage $asyncMap = null): \Generator
319319
{
320320
$r->stream = null;
321321
$response = $r->response;

Response/CurlResponse.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
4343
public function __construct(
4444
private CurlClientState $multi,
4545
\CurlHandle|string $ch,
46-
array $options = null,
47-
LoggerInterface $logger = null,
46+
?array $options = null,
47+
?LoggerInterface $logger = null,
4848
string $method = 'GET',
49-
callable $resolveRedirect = null,
50-
int $curlVersion = null,
51-
string $originalUrl = null,
49+
?callable $resolveRedirect = null,
50+
?int $curlVersion = null,
51+
?string $originalUrl = null,
5252
) {
5353
if ($ch instanceof \CurlHandle) {
5454
$this->handle = $ch;
@@ -197,7 +197,7 @@ public function __construct(
197197
});
198198
}
199199

200-
public function getInfo(string $type = null): mixed
200+
public function getInfo(?string $type = null): mixed
201201
{
202202
if (!$info = $this->finalInfo) {
203203
$info = array_merge($this->info, curl_getinfo($this->handle));
@@ -270,7 +270,7 @@ private static function schedule(self $response, array &$runningResponses): void
270270
/**
271271
* @param CurlClientState $multi
272272
*/
273-
private static function perform(ClientState $multi, array &$responses = null): void
273+
private static function perform(ClientState $multi, ?array &$responses = null): void
274274
{
275275
if ($multi->performing) {
276276
if ($responses) {

Response/HttplugPromise.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
) {
2929
}
3030

31-
public function then(callable $onFulfilled = null, callable $onRejected = null): self
31+
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): self
3232
{
3333
return new self($this->promise->then(
3434
$this->wrapThenCallback($onFulfilled),

Response/MockResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getRequestMethod(): string
9797
return $this->requestMethod;
9898
}
9999

100-
public function getInfo(string $type = null): mixed
100+
public function getInfo(?string $type = null): mixed
101101
{
102102
return null !== $type ? $this->info[$type] ?? null : $this->info;
103103
}

Response/NativeResponse.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function __construct(
8686
});
8787
}
8888

89-
public function getInfo(string $type = null): mixed
89+
public function getInfo(?string $type = null): mixed
9090
{
9191
if (!$info = $this->finalInfo) {
9292
$info = $this->info;
@@ -228,7 +228,7 @@ private static function schedule(self $response, array &$runningResponses): void
228228
/**
229229
* @param NativeClientState $multi
230230
*/
231-
private static function perform(ClientState $multi, array &$responses = null): void
231+
private static function perform(ClientState $multi, ?array &$responses = null): void
232232
{
233233
foreach ($multi->openHandles as $i => [$pauseExpiry, $h, $buffer, $onProgress]) {
234234
if ($pauseExpiry) {

Response/StreamWrapper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class StreamWrapper
4545
*
4646
* @return resource
4747
*/
48-
public static function createResource(ResponseInterface $response, HttpClientInterface $client = null)
48+
public static function createResource(ResponseInterface $response, ?HttpClientInterface $client = null)
4949
{
5050
if ($response instanceof StreamableInterface) {
5151
$stack = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 2);

Response/TraceableResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function cancel(): void
129129
}
130130
}
131131

132-
public function getInfo(string $type = null): mixed
132+
public function getInfo(?string $type = null): mixed
133133
{
134134
return $this->response->getInfo($type);
135135
}

Response/TransportResponseTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private function doDestruct(): void
139139
*
140140
* @internal
141141
*/
142-
public static function stream(iterable $responses, float $timeout = null): \Generator
142+
public static function stream(iterable $responses, ?float $timeout = null): \Generator
143143
{
144144
$runningResponses = [];
145145

RetryableHttpClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class RetryableHttpClient implements HttpClientInterface, ResetInterface
3939
/**
4040
* @param int $maxRetries The maximum number of times to retry
4141
*/
42-
public function __construct(HttpClientInterface $client, RetryStrategyInterface $strategy = null, int $maxRetries = 3, LoggerInterface $logger = null)
42+
public function __construct(HttpClientInterface $client, ?RetryStrategyInterface $strategy = null, int $maxRetries = 3, ?LoggerInterface $logger = null)
4343
{
4444
$this->client = $client;
4545
$this->strategy = $strategy ?? new GenericRetryStrategy();

0 commit comments

Comments
 (0)