mirror of
https://github.com/symfony/http-client.git
synced 2026-03-24 00:12:11 +01:00
Merge branch '5.4' into 6.3
* 5.4: 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
This commit is contained in:
@@ -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(...);
|
||||
|
||||
@@ -148,7 +148,7 @@ final class AmpHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||
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];
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -105,7 +105,7 @@ class CachingHttpClient implements HttpClientInterface, ResetInterface
|
||||
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];
|
||||
|
||||
@@ -84,7 +84,7 @@ class ErrorChunk implements ChunkInterface
|
||||
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;
|
||||
|
||||
@@ -317,7 +317,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||
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];
|
||||
|
||||
@@ -38,7 +38,7 @@ final class HttpClientDataCollector extends DataCollector implements LateDataCol
|
||||
$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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -35,7 +35,7 @@ trait DecoratorTrait
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -535,7 +535,7 @@ trait HttpClientTrait
|
||||
/**
|
||||
* @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;
|
||||
|
||||
|
||||
@@ -70,7 +70,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;
|
||||
@@ -144,7 +144,7 @@ final class HttplugClient implements ClientInterface, HttpAsyncClient, RequestFa
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ final class HttplugClient implements ClientInterface, HttpAsyncClient, RequestFa
|
||||
}
|
||||
}
|
||||
|
||||
private function sendPsr7Request(RequestInterface $request, bool $buffer = null): ResponseInterface
|
||||
private function sendPsr7Request(RequestInterface $request, ?bool $buffer = null): ResponseInterface
|
||||
{
|
||||
try {
|
||||
$body = $request->getBody();
|
||||
|
||||
@@ -149,7 +149,7 @@ final class AmpClientState extends ClientState
|
||||
public $uri;
|
||||
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) {
|
||||
|
||||
@@ -32,7 +32,7 @@ class AmpResolver implements Dns\Resolver
|
||||
$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);
|
||||
|
||||
@@ -46,7 +46,7 @@ final class HttplugWaitLoop
|
||||
$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;
|
||||
|
||||
@@ -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;
|
||||
@@ -84,7 +84,7 @@ class MockHttpClient implements HttpClientInterface, ResetInterface
|
||||
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];
|
||||
|
||||
@@ -264,7 +264,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
|
||||
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];
|
||||
|
||||
@@ -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__));
|
||||
@@ -72,7 +72,7 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,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;
|
||||
|
||||
@@ -134,7 +134,7 @@ final class AmpResponse implements ResponseInterface, StreamableInterface
|
||||
});
|
||||
}
|
||||
|
||||
public function getInfo(string $type = null): mixed
|
||||
public function getInfo(?string $type = null): mixed
|
||||
{
|
||||
return null !== $type ? $this->info[$type] ?? null : $this->info;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ final class AmpResponse implements ResponseInterface, StreamableInterface
|
||||
/**
|
||||
* @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) {
|
||||
|
||||
@@ -114,7 +114,7 @@ final class AsyncContext
|
||||
/**
|
||||
* 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);
|
||||
@@ -187,7 +187,7 @@ final class AsyncContext
|
||||
*
|
||||
* @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;
|
||||
|
||||
@@ -44,7 +44,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;
|
||||
@@ -57,7 +57,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
|
||||
}
|
||||
$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;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
|
||||
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);
|
||||
@@ -206,7 +206,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
|
||||
/**
|
||||
* @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 = [];
|
||||
@@ -314,7 +314,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
|
||||
/**
|
||||
* @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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -193,7 +193,7 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
|
||||
});
|
||||
}
|
||||
|
||||
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));
|
||||
@@ -266,7 +266,7 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
|
||||
/**
|
||||
* @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) {
|
||||
|
||||
@@ -30,7 +30,7 @@ final class HttplugPromise implements HttplugPromiseInterface
|
||||
$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),
|
||||
|
||||
@@ -88,7 +88,7 @@ class MockResponse implements ResponseInterface, StreamableInterface
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ final class NativeResponse implements ResponseInterface, StreamableInterface
|
||||
});
|
||||
}
|
||||
|
||||
public function getInfo(string $type = null): mixed
|
||||
public function getInfo(?string $type = null): mixed
|
||||
{
|
||||
if (!$info = $this->finalInfo) {
|
||||
$info = $this->info;
|
||||
@@ -228,7 +228,7 @@ final class NativeResponse implements ResponseInterface, StreamableInterface
|
||||
/**
|
||||
* @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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -134,7 +134,7 @@ class TraceableResponse implements ResponseInterface, StreamableInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function getInfo(string $type = null): mixed
|
||||
public function getInfo(?string $type = null): mixed
|
||||
{
|
||||
return $this->response->getInfo($type);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ trait TransportResponseTrait
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function stream(iterable $responses, float $timeout = null): \Generator
|
||||
public static function stream(iterable $responses, ?float $timeout = null): \Generator
|
||||
{
|
||||
$runningResponses = [];
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class RetryableHttpClient implements HttpClientInterface, ResetInterface
|
||||
/**
|
||||
* @param int $maxRetries The maximum number of times to retry
|
||||
*/
|
||||
public function __construct(HttpClientInterface $client, RetryStrategyInterface $strategy = null, int $maxRetries = 3, LoggerInterface $logger = null)
|
||||
public function __construct(HttpClientInterface $client, ?RetryStrategyInterface $strategy = null, int $maxRetries = 3, ?LoggerInterface $logger = null)
|
||||
{
|
||||
$this->client = $client;
|
||||
$this->strategy = $strategy ?? new GenericRetryStrategy();
|
||||
|
||||
@@ -32,7 +32,7 @@ class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAw
|
||||
private array $defaultOptionsByRegexp;
|
||||
private ?string $defaultRegexp;
|
||||
|
||||
public function __construct(HttpClientInterface $client, array $defaultOptionsByRegexp, string $defaultRegexp = null)
|
||||
public function __construct(HttpClientInterface $client, array $defaultOptionsByRegexp, ?string $defaultRegexp = null)
|
||||
{
|
||||
$this->client = $client;
|
||||
$this->defaultOptionsByRegexp = $defaultOptionsByRegexp;
|
||||
@@ -43,7 +43,7 @@ class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAw
|
||||
}
|
||||
}
|
||||
|
||||
public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], string $regexp = null): self
|
||||
public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], ?string $regexp = null): self
|
||||
{
|
||||
$regexp ??= preg_quote(implode('', self::resolveUrl(self::parseUrl('.'), self::parseUrl($baseUri))));
|
||||
|
||||
@@ -88,7 +88,7 @@ class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAw
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||
|
||||
class AsyncDecoratorTraitTest extends NativeHttpClientTest
|
||||
{
|
||||
protected function getHttpClient(string $testCase, \Closure $chunkFilter = null, HttpClientInterface $decoratedClient = null): HttpClientInterface
|
||||
protected function getHttpClient(string $testCase, ?\Closure $chunkFilter = null, ?HttpClientInterface $decoratedClient = null): HttpClientInterface
|
||||
{
|
||||
if ('testHandleIsRemovedOnException' === $testCase) {
|
||||
$this->markTestSkipped("AsyncDecoratorTrait doesn't cache handles");
|
||||
@@ -42,7 +42,7 @@ class AsyncDecoratorTraitTest extends NativeHttpClientTest
|
||||
|
||||
private $chunkFilter;
|
||||
|
||||
public function __construct(HttpClientInterface $client, \Closure $chunkFilter = null)
|
||||
public function __construct(HttpClientInterface $client, ?\Closure $chunkFilter = null)
|
||||
{
|
||||
$this->chunkFilter = $chunkFilter;
|
||||
$this->client = $client;
|
||||
|
||||
@@ -30,7 +30,7 @@ final class TraceableHttpClient implements HttpClientInterface, ResetInterface,
|
||||
private ?Stopwatch $stopwatch;
|
||||
private \ArrayObject $tracedRequests;
|
||||
|
||||
public function __construct(HttpClientInterface $client, Stopwatch $stopwatch = null)
|
||||
public function __construct(HttpClientInterface $client, ?Stopwatch $stopwatch = null)
|
||||
{
|
||||
$this->client = $client;
|
||||
$this->stopwatch = $stopwatch;
|
||||
@@ -66,7 +66,7 @@ final class TraceableHttpClient implements HttpClientInterface, ResetInterface,
|
||||
return new TraceableResponse($this->client, $this->client->request($method, $url, $options), $content, $this->stopwatch?->start("$method $url", 'http_client'));
|
||||
}
|
||||
|
||||
public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
|
||||
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
|
||||
{
|
||||
if ($responses instanceof TraceableResponse) {
|
||||
$responses = [$responses];
|
||||
|
||||
@@ -22,7 +22,7 @@ class UriTemplateHttpClient implements HttpClientInterface, ResetInterface
|
||||
/**
|
||||
* @param (\Closure(string $url, array $vars): string)|null $expander
|
||||
*/
|
||||
public function __construct(HttpClientInterface $client = null, private ?\Closure $expander = null, private array $defaultVars = [])
|
||||
public function __construct(?HttpClientInterface $client = null, private ?\Closure $expander = null, private array $defaultVars = [])
|
||||
{
|
||||
$this->client = $client ?? HttpClient::create();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user