Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  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
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents db71498 + d987c32 commit dc4ee0b
Show file tree
Hide file tree
Showing 32 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions AmpHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class AmpHttpClient implements HttpClientInterface, LoggerAwareInterface,
*
* @see HttpClientInterface::OPTIONS_DEFAULTS for available options
*/
public function __construct(array $defaultOptions = [], callable $clientConfigurator = null, int $maxHostConnections = 6, int $maxPendingPushes = 50)
public function __construct(array $defaultOptions = [], ?callable $clientConfigurator = null, int $maxHostConnections = 6, int $maxPendingPushes = 50)
{
$this->defaultOptions['buffer'] ??= self::shouldBuffer(...);

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

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
if ($responses instanceof AmpResponse) {
$responses = [$responses];
Expand Down
2 changes: 1 addition & 1 deletion AsyncDecoratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait AsyncDecoratorTrait
*/
abstract public function request(string $method, string $url, array $options = []): ResponseInterface;

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
if ($responses instanceof AsyncResponse) {
$responses = [$responses];
Expand Down
2 changes: 1 addition & 1 deletion CachingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function request(string $method, string $url, array $options = []): Respo
return MockResponse::fromRequest($method, $url, $options, $response);
}

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
if ($responses instanceof ResponseInterface) {
$responses = [$responses];
Expand Down
2 changes: 1 addition & 1 deletion Chunk/ErrorChunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getError(): ?string
return $this->errorMessage;
}

public function didThrow(bool $didThrow = null): bool
public function didThrow(?bool $didThrow = null): bool
{
if (null !== $didThrow && $this->didThrow !== $didThrow) {
return !$this->didThrow = $didThrow;
Expand Down
2 changes: 1 addition & 1 deletion CurlHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function request(string $method, string $url, array $options = []): Respo
return $pushedResponse ?? new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host, $port), CurlClientState::$curlVersion['version_number'], $url);
}

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
if ($responses instanceof CurlResponse) {
$responses = [$responses];
Expand Down
2 changes: 1 addition & 1 deletion DataCollector/HttpClientDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function registerClient(string $name, TraceableHttpClient $client): void
$this->clients[$name] = $client;
}

public function collect(Request $request, Response $response, \Throwable $exception = null): void
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
$this->lateCollect();
}
Expand Down
4 changes: 2 additions & 2 deletions DecoratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait DecoratorTrait
{
private HttpClientInterface $client;

public function __construct(HttpClientInterface $client = null)
public function __construct(?HttpClientInterface $client = null)
{
$this->client = $client ?? HttpClient::create();
}
Expand All @@ -35,7 +35,7 @@ public function request(string $method, string $url, array $options = []): Respo
return $this->client->request($method, $url, $options);
}

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
return $this->client->stream($responses, $timeout);
}
Expand Down
2 changes: 1 addition & 1 deletion EventSourceHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class EventSourceHttpClient implements HttpClientInterface, ResetInterface

private float $reconnectionTime;

public function __construct(HttpClientInterface $client = null, float $reconnectionTime = 10.0)
public function __construct(?HttpClientInterface $client = null, float $reconnectionTime = 10.0)
{
$this->client = $client ?? HttpClient::create();
$this->reconnectionTime = $reconnectionTime;
Expand Down
2 changes: 1 addition & 1 deletion HttpClientTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ private static function normalizePeerFingerprint(mixed $fingerprint): array
/**
* @throws InvalidArgumentException When the value cannot be json-encoded
*/
private static function jsonEncode(mixed $value, int $flags = null, int $maxDepth = 512): string
private static function jsonEncode(mixed $value, ?int $flags = null, int $maxDepth = 512): string
{
$flags ??= \JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_PRESERVE_ZERO_FRACTION;

Expand Down
6 changes: 3 additions & 3 deletions HttplugClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class HttplugClient implements ClientInterface, HttpAsyncClient, RequestFa

private HttplugWaitLoop $waitLoop;

public function __construct(HttpClientInterface $client = null, ResponseFactoryInterface $responseFactory = null, StreamFactoryInterface $streamFactory = null)
public function __construct(?HttpClientInterface $client = null, ?ResponseFactoryInterface $responseFactory = null, ?StreamFactoryInterface $streamFactory = null)
{
$this->client = $client ?? HttpClient::create();
$streamFactory ??= $responseFactory instanceof StreamFactoryInterface ? $responseFactory : null;
Expand Down Expand Up @@ -143,7 +143,7 @@ public function sendAsyncRequest(RequestInterface $request): HttplugPromise
*
* @return int The number of remaining pending promises
*/
public function wait(float $maxDuration = null, float $idleTimeout = null): int
public function wait(?float $maxDuration = null, ?float $idleTimeout = null): int
{
return $this->waitLoop->wait(null, $maxDuration, $idleTimeout);
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public function reset(): void
}
}

private function sendPsr7Request(RequestInterface $request, bool $buffer = null): ResponseInterface
private function sendPsr7Request(RequestInterface $request, ?bool $buffer = null): ResponseInterface
{
try {
$body = $request->getBody();
Expand Down
2 changes: 1 addition & 1 deletion Internal/AmpClientState.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function getClient(array $options): array
/** @var resource|null */
public $handle;

public function connect(string $uri, ConnectContext $context = null, CancellationToken $token = null): Promise
public function connect(string $uri, ?ConnectContext $context = null, ?CancellationToken $token = null): Promise
{
$result = $this->connector->connect($this->uri ?? $uri, $context, $token);
$result->onResolve(function ($e, $socket) {
Expand Down
2 changes: 1 addition & 1 deletion Internal/AmpResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(array &$dnsMap)
$this->dnsMap = &$dnsMap;
}

public function resolve(string $name, int $typeRestriction = null): Promise
public function resolve(string $name, ?int $typeRestriction = null): Promise
{
if (!isset($this->dnsMap[$name]) || !\in_array($typeRestriction, [Record::A, null], true)) {
return Dns\resolver()->resolve($name, $typeRestriction);
Expand Down
2 changes: 1 addition & 1 deletion Internal/HttplugWaitLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(HttpClientInterface $client, ?\SplObjectStorage $pro
$this->streamFactory = $streamFactory;
}

public function wait(?ResponseInterface $pendingResponse, float $maxDuration = null, float $idleTimeout = null): int
public function wait(?ResponseInterface $pendingResponse, ?float $maxDuration = null, ?float $idleTimeout = null): int
{
if (!$this->promisePool) {
return 0;
Expand Down
4 changes: 2 additions & 2 deletions MockHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MockHttpClient implements HttpClientInterface, ResetInterface
/**
* @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory
*/
public function __construct(callable|iterable|ResponseInterface $responseFactory = null, ?string $baseUri = 'https://example.com')
public function __construct(callable|iterable|ResponseInterface|null $responseFactory = null, ?string $baseUri = 'https://example.com')
{
$this->setResponseFactory($responseFactory);
$this->defaultOptions['base_uri'] = $baseUri;
Expand Down Expand Up @@ -84,7 +84,7 @@ public function request(string $method, string $url, array $options = []): Respo
return MockResponse::fromRequest($method, $url, $options, $response);
}

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
if ($responses instanceof ResponseInterface) {
$responses = [$responses];
Expand Down
2 changes: 1 addition & 1 deletion NativeHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function request(string $method, string $url, array $options = []): Respo
return new NativeResponse($this->multi, $context, implode('', $url), $options, $info, $resolver, $onProgress, $this->logger);
}

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
if ($responses instanceof NativeResponse) {
$responses = [$responses];
Expand Down
4 changes: 2 additions & 2 deletions NoPrivateNetworkHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
* @param string|array|null $subnets String or array of subnets using CIDR notation that will be used by IpUtils.
* If null is passed, the standard private subnets will be used.
*/
public function __construct(HttpClientInterface $client, string|array $subnets = null)
public function __construct(HttpClientInterface $client, string|array|null $subnets = null)
{
if (!class_exists(IpUtils::class)) {
throw new \LogicException(sprintf('You cannot use "%s" if the HttpFoundation component is not installed. Try running "composer require symfony/http-foundation".', __CLASS__));
Expand Down Expand Up @@ -72,7 +72,7 @@ public function request(string $method, string $url, array $options = []): Respo
return $this->client->request($method, $url, $options);
}

public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
return $this->client->stream($responses, $timeout);
}
Expand Down
2 changes: 1 addition & 1 deletion Psr18Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class Psr18Client implements ClientInterface, RequestFactoryInterface, Str
private ResponseFactoryInterface $responseFactory;
private StreamFactoryInterface $streamFactory;

public function __construct(HttpClientInterface $client = null, ResponseFactoryInterface $responseFactory = null, StreamFactoryInterface $streamFactory = null)
public function __construct(?HttpClientInterface $client = null, ?ResponseFactoryInterface $responseFactory = null, ?StreamFactoryInterface $streamFactory = null)
{
$this->client = $client ?? HttpClient::create();
$streamFactory ??= $responseFactory instanceof StreamFactoryInterface ? $responseFactory : null;
Expand Down
4 changes: 2 additions & 2 deletions Response/AmpResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function __construct(AmpClientState $multi, Request $request, array $opti
});
}

public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
return null !== $type ? $this->info[$type] ?? null : $this->info;
}
Expand Down Expand Up @@ -179,7 +179,7 @@ private static function schedule(self $response, array &$runningResponses): void
/**
* @param AmpClientState $multi
*/
private static function perform(ClientState $multi, array &$responses = null): void
private static function perform(ClientState $multi, ?array &$responses = null): void
{
if ($responses) {
foreach ($responses as $response) {
Expand Down
4 changes: 2 additions & 2 deletions Response/AsyncContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function cancel(): ChunkInterface
/**
* Returns the current info of the response.
*/
public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
if (null !== $type) {
return $this->info[$type] ?? $this->response->getInfo($type);
Expand Down Expand Up @@ -189,7 +189,7 @@ public function replaceResponse(ResponseInterface $response): ResponseInterface
*
* @param ?callable(ChunkInterface, self): ?\Iterator $passthru
*/
public function passthru(callable $passthru = null): void
public function passthru(?callable $passthru = null): void
{
$this->passthru = $passthru ?? static function ($chunk, $context) {
$context->passthru = null;
Expand Down
10 changes: 5 additions & 5 deletions Response/AsyncResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
/**
* @param ?callable(ChunkInterface, AsyncContext): ?\Iterator $passthru
*/
public function __construct(HttpClientInterface $client, string $method, string $url, array $options, callable $passthru = null)
public function __construct(HttpClientInterface $client, string $method, string $url, array $options, ?callable $passthru = null)
{
$this->client = $client;
$this->shouldBuffer = $options['buffer'] ?? true;
Expand All @@ -58,7 +58,7 @@ public function __construct(HttpClientInterface $client, string $method, string
}
$this->response = $client->request($method, $url, ['buffer' => false] + $options);
$this->passthru = $passthru;
$this->initializer = static function (self $response, float $timeout = null) {
$this->initializer = static function (self $response, ?float $timeout = null) {
if (null === $response->shouldBuffer) {
return false;
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public function getHeaders(bool $throw = true): array
return $headers;
}

public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
if (null !== $type) {
return $this->info[$type] ?? $this->response->getInfo($type);
Expand Down Expand Up @@ -207,7 +207,7 @@ public function __destruct()
/**
* @internal
*/
public static function stream(iterable $responses, float $timeout = null, string $class = null): \Generator
public static function stream(iterable $responses, ?float $timeout = null, ?string $class = null): \Generator
{
while ($responses) {
$wrappedResponses = [];
Expand Down Expand Up @@ -315,7 +315,7 @@ public static function stream(iterable $responses, float $timeout = null, string
/**
* @param \SplObjectStorage<ResponseInterface, AsyncResponse>|null $asyncMap
*/
private static function passthru(HttpClientInterface $client, self $r, ChunkInterface $chunk, \SplObjectStorage $asyncMap = null): \Generator
private static function passthru(HttpClientInterface $client, self $r, ChunkInterface $chunk, ?\SplObjectStorage $asyncMap = null): \Generator
{
$r->stream = null;
$response = $r->response;
Expand Down
6 changes: 3 additions & 3 deletions Response/CurlResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
/**
* @internal
*/
public function __construct(CurlClientState $multi, \CurlHandle|string $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null, string $originalUrl = null)
public function __construct(CurlClientState $multi, \CurlHandle|string $ch, ?array $options = null, ?LoggerInterface $logger = null, string $method = 'GET', ?callable $resolveRedirect = null, ?int $curlVersion = null, ?string $originalUrl = null)
{
$this->multi = $multi;

Expand Down Expand Up @@ -193,7 +193,7 @@ public function __construct(CurlClientState $multi, \CurlHandle|string $ch, arra
});
}

public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
if (!$info = $this->finalInfo) {
$info = array_merge($this->info, curl_getinfo($this->handle));
Expand Down Expand Up @@ -266,7 +266,7 @@ private static function schedule(self $response, array &$runningResponses): void
/**
* @param CurlClientState $multi
*/
private static function perform(ClientState $multi, array &$responses = null): void
private static function perform(ClientState $multi, ?array &$responses = null): void
{
if ($multi->performing) {
if ($responses) {
Expand Down
2 changes: 1 addition & 1 deletion Response/HttplugPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(GuzzlePromiseInterface $promise)
$this->promise = $promise;
}

public function then(callable $onFulfilled = null, callable $onRejected = null): self
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): self
{
return new self($this->promise->then(
$this->wrapThenCallback($onFulfilled),
Expand Down
2 changes: 1 addition & 1 deletion Response/MockResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function getRequestMethod(): string
return $this->requestMethod;
}

public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
return null !== $type ? $this->info[$type] ?? null : $this->info;
}
Expand Down
4 changes: 2 additions & 2 deletions Response/NativeResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct(NativeClientState $multi, $context, string $url, arr
});
}

public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
if (!$info = $this->finalInfo) {
$info = $this->info;
Expand Down Expand Up @@ -228,7 +228,7 @@ private static function schedule(self $response, array &$runningResponses): void
/**
* @param NativeClientState $multi
*/
private static function perform(ClientState $multi, array &$responses = null): void
private static function perform(ClientState $multi, ?array &$responses = null): void
{
foreach ($multi->openHandles as $i => [$pauseExpiry, $h, $buffer, $onProgress]) {
if ($pauseExpiry) {
Expand Down
2 changes: 1 addition & 1 deletion Response/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class StreamWrapper
*
* @return resource
*/
public static function createResource(ResponseInterface $response, HttpClientInterface $client = null)
public static function createResource(ResponseInterface $response, ?HttpClientInterface $client = null)
{
if ($response instanceof StreamableInterface) {
$stack = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 2);
Expand Down
4 changes: 2 additions & 2 deletions Response/TraceableResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TraceableResponse implements ResponseInterface, StreamableInterface
private mixed $content;
private ?StopwatchEvent $event;

public function __construct(HttpClientInterface $client, ResponseInterface $response, &$content, StopwatchEvent $event = null)
public function __construct(HttpClientInterface $client, ResponseInterface $response, &$content, ?StopwatchEvent $event = null)
{
$this->client = $client;
$this->response = $response;
Expand Down Expand Up @@ -134,7 +134,7 @@ public function cancel(): void
}
}

public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
return $this->response->getInfo($type);
}
Expand Down
2 changes: 1 addition & 1 deletion Response/TransportResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private function doDestruct(): void
*
* @internal
*/
public static function stream(iterable $responses, float $timeout = null): \Generator
public static function stream(iterable $responses, ?float $timeout = null): \Generator
{
$runningResponses = [];

Expand Down
Loading

0 comments on commit dc4ee0b

Please sign in to comment.