From 57779974f98816c4e7ce89d318394515442d4ca0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Jan 2024 14:51:25 +0100 Subject: [PATCH] Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value --- AmpHttpClient.php | 4 ++-- AsyncDecoratorTrait.php | 2 +- CachingHttpClient.php | 2 +- Chunk/ErrorChunk.php | 2 +- CurlHttpClient.php | 2 +- DataCollector/HttpClientDataCollector.php | 2 +- DecoratorTrait.php | 4 ++-- EventSourceHttpClient.php | 2 +- HttpClientTrait.php | 2 +- HttplugClient.php | 6 +++--- Internal/AmpClientState.php | 2 +- Internal/AmpResolver.php | 2 +- Internal/HttplugWaitLoop.php | 2 +- MockHttpClient.php | 2 +- NativeHttpClient.php | 2 +- NoPrivateNetworkHttpClient.php | 2 +- Psr18Client.php | 2 +- Response/AmpResponse.php | 4 ++-- Response/AsyncContext.php | 4 ++-- Response/AsyncResponse.php | 10 +++++----- Response/CurlResponse.php | 6 +++--- Response/HttplugPromise.php | 2 +- Response/MockResponse.php | 2 +- Response/NativeResponse.php | 4 ++-- Response/StreamWrapper.php | 2 +- Response/TraceableResponse.php | 4 ++-- Response/TransportResponseTrait.php | 2 +- RetryableHttpClient.php | 2 +- ScopingHttpClient.php | 6 +++--- Tests/AsyncDecoratorTraitTest.php | 4 ++-- TraceableHttpClient.php | 4 ++-- 31 files changed, 49 insertions(+), 49 deletions(-) diff --git a/AmpHttpClient.php b/AmpHttpClient.php index 2ab7e27..48df9ca 100644 --- a/AmpHttpClient.php +++ b/AmpHttpClient.php @@ -62,7 +62,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'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']); @@ -151,7 +151,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { if ($responses instanceof AmpResponse) { $responses = [$responses]; diff --git a/AsyncDecoratorTrait.php b/AsyncDecoratorTrait.php index aff402d..21f716b 100644 --- a/AsyncDecoratorTrait.php +++ b/AsyncDecoratorTrait.php @@ -35,7 +35,7 @@ abstract public function request(string $method, string $url, array $options = [ /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { if ($responses instanceof AsyncResponse) { $responses = [$responses]; diff --git a/CachingHttpClient.php b/CachingHttpClient.php index e1d7023..3d2fe8c 100644 --- a/CachingHttpClient.php +++ b/CachingHttpClient.php @@ -110,7 +110,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { if ($responses instanceof ResponseInterface) { $responses = [$responses]; diff --git a/Chunk/ErrorChunk.php b/Chunk/ErrorChunk.php index a19f433..bfb9097 100644 --- a/Chunk/ErrorChunk.php +++ b/Chunk/ErrorChunk.php @@ -111,7 +111,7 @@ public function getError(): ?string /** * @return bool Whether the wrapped error has been thrown or not */ - public function didThrow(bool $didThrow = null): bool + public function didThrow(?bool $didThrow = null): bool { if (null !== $didThrow && $this->didThrow !== $didThrow) { return !$this->didThrow = $didThrow; diff --git a/CurlHttpClient.php b/CurlHttpClient.php index ef6d700..52e1c74 100644 --- a/CurlHttpClient.php +++ b/CurlHttpClient.php @@ -316,7 +316,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { if ($responses instanceof CurlResponse) { $responses = [$responses]; diff --git a/DataCollector/HttpClientDataCollector.php b/DataCollector/HttpClientDataCollector.php index 1925786..88172b3 100644 --- a/DataCollector/HttpClientDataCollector.php +++ b/DataCollector/HttpClientDataCollector.php @@ -36,7 +36,7 @@ public function registerClient(string $name, TraceableHttpClient $client) /** * {@inheritdoc} */ - public function collect(Request $request, Response $response, \Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null) { $this->lateCollect(); } diff --git a/DecoratorTrait.php b/DecoratorTrait.php index 790fc32..cb3ca2a 100644 --- a/DecoratorTrait.php +++ b/DecoratorTrait.php @@ -25,7 +25,7 @@ trait DecoratorTrait { private $client; - public function __construct(HttpClientInterface $client = null) + public function __construct(?HttpClientInterface $client = null) { $this->client = $client ?? HttpClient::create(); } @@ -41,7 +41,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { return $this->client->stream($responses, $timeout); } diff --git a/EventSourceHttpClient.php b/EventSourceHttpClient.php index 60e4e82..e801c1c 100644 --- a/EventSourceHttpClient.php +++ b/EventSourceHttpClient.php @@ -33,7 +33,7 @@ final class EventSourceHttpClient implements HttpClientInterface, ResetInterface private $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; diff --git a/HttpClientTrait.php b/HttpClientTrait.php index 3d60443..3f44f36 100644 --- a/HttpClientTrait.php +++ b/HttpClientTrait.php @@ -419,7 +419,7 @@ private static function normalizePeerFingerprint($fingerprint): array * * @throws InvalidArgumentException When the value cannot be json-encoded */ - private static function jsonEncode($value, int $flags = null, int $maxDepth = 512): string + private static function jsonEncode($value, ?int $flags = null, int $maxDepth = 512): string { $flags = $flags ?? (\JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_PRESERVE_ZERO_FRACTION); diff --git a/HttplugClient.php b/HttplugClient.php index c2fd463..8442b06 100644 --- a/HttplugClient.php +++ b/HttplugClient.php @@ -71,7 +71,7 @@ final class HttplugClient implements HttplugInterface, HttpAsyncClient, RequestF private $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(); $this->responseFactory = $responseFactory; @@ -145,7 +145,7 @@ public function sendAsyncRequest(RequestInterface $request): Promise * * @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); } @@ -247,7 +247,7 @@ public function reset() } } - private function sendPsr7Request(RequestInterface $request, bool $buffer = null): ResponseInterface + private function sendPsr7Request(RequestInterface $request, ?bool $buffer = null): ResponseInterface { try { $body = $request->getBody(); diff --git a/Internal/AmpClientState.php b/Internal/AmpClientState.php index 3061f08..61a0c00 100644 --- a/Internal/AmpClientState.php +++ b/Internal/AmpClientState.php @@ -149,7 +149,7 @@ private function getClient(array $options): array 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) { diff --git a/Internal/AmpResolver.php b/Internal/AmpResolver.php index d31476a..402f71d 100644 --- a/Internal/AmpResolver.php +++ b/Internal/AmpResolver.php @@ -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); diff --git a/Internal/HttplugWaitLoop.php b/Internal/HttplugWaitLoop.php index 66bbc45..9dbeaad 100644 --- a/Internal/HttplugWaitLoop.php +++ b/Internal/HttplugWaitLoop.php @@ -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; diff --git a/MockHttpClient.php b/MockHttpClient.php index fecba0e..4e8c6a8 100644 --- a/MockHttpClient.php +++ b/MockHttpClient.php @@ -90,7 +90,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { if ($responses instanceof ResponseInterface) { $responses = [$responses]; diff --git a/NativeHttpClient.php b/NativeHttpClient.php index 63fcc1c..3d4747a 100644 --- a/NativeHttpClient.php +++ b/NativeHttpClient.php @@ -263,7 +263,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { if ($responses instanceof NativeResponse) { $responses = [$responses]; diff --git a/NoPrivateNetworkHttpClient.php b/NoPrivateNetworkHttpClient.php index 911cce9..757a9e8 100644 --- a/NoPrivateNetworkHttpClient.php +++ b/NoPrivateNetworkHttpClient.php @@ -97,7 +97,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { return $this->client->stream($responses, $timeout); } diff --git a/Psr18Client.php b/Psr18Client.php index 0cd8f7d..b389dfe 100644 --- a/Psr18Client.php +++ b/Psr18Client.php @@ -58,7 +58,7 @@ final class Psr18Client implements ClientInterface, RequestFactoryInterface, Str private $responseFactory; private $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(); $this->responseFactory = $responseFactory; diff --git a/Response/AmpResponse.php b/Response/AmpResponse.php index 900c70d..e4999b7 100644 --- a/Response/AmpResponse.php +++ b/Response/AmpResponse.php @@ -138,7 +138,7 @@ public function __construct(AmpClientState $multi, Request $request, array $opti /** * {@inheritdoc} */ - public function getInfo(string $type = null) + public function getInfo(?string $type = null) { return null !== $type ? $this->info[$type] ?? null : $this->info; } @@ -188,7 +188,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) { diff --git a/Response/AsyncContext.php b/Response/AsyncContext.php index e0c0ebb..3c5397c 100644 --- a/Response/AsyncContext.php +++ b/Response/AsyncContext.php @@ -111,7 +111,7 @@ public function cancel(): ChunkInterface /** * Returns the current info of the response. */ - public function getInfo(string $type = null) + public function getInfo(?string $type = null) { if (null !== $type) { return $this->info[$type] ?? $this->response->getInfo($type); @@ -184,7 +184,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; diff --git a/Response/AsyncResponse.php b/Response/AsyncResponse.php index 80c9f7d..d423ba3 100644 --- a/Response/AsyncResponse.php +++ b/Response/AsyncResponse.php @@ -44,7 +44,7 @@ final 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 @@ 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; } @@ -114,7 +114,7 @@ public function getHeaders(bool $throw = true): array return $headers; } - public function getInfo(string $type = null) + public function getInfo(?string $type = null) { if (null !== $type) { return $this->info[$type] ?? $this->response->getInfo($type); @@ -209,7 +209,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 = []; @@ -317,7 +317,7 @@ public static function stream(iterable $responses, float $timeout = null, string /** * @param \SplObjectStorage|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; diff --git a/Response/CurlResponse.php b/Response/CurlResponse.php index 2418203..eb110a5 100644 --- a/Response/CurlResponse.php +++ b/Response/CurlResponse.php @@ -40,7 +40,7 @@ final class CurlResponse implements ResponseInterface, StreamableInterface * * @internal */ - public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null) + public function __construct(CurlClientState $multi, $ch, ?array $options = null, ?LoggerInterface $logger = null, string $method = 'GET', ?callable $resolveRedirect = null, ?int $curlVersion = null) { $this->multi = $multi; @@ -193,7 +193,7 @@ public function __construct(CurlClientState $multi, $ch, array $options = null, /** * {@inheritdoc} */ - public function getInfo(string $type = null) + public function getInfo(?string $type = null) { if (!$info = $this->finalInfo) { $info = array_merge($this->info, curl_getinfo($this->handle)); @@ -274,7 +274,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) { diff --git a/Response/HttplugPromise.php b/Response/HttplugPromise.php index 2efacca..d15b473 100644 --- a/Response/HttplugPromise.php +++ b/Response/HttplugPromise.php @@ -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), diff --git a/Response/MockResponse.php b/Response/MockResponse.php index 2c00108..dc65a49 100644 --- a/Response/MockResponse.php +++ b/Response/MockResponse.php @@ -93,7 +93,7 @@ public function getRequestMethod(): string /** * {@inheritdoc} */ - public function getInfo(string $type = null) + public function getInfo(?string $type = null) { return null !== $type ? $this->info[$type] ?? null : $this->info; } diff --git a/Response/NativeResponse.php b/Response/NativeResponse.php index c00e946..6eeaf60 100644 --- a/Response/NativeResponse.php +++ b/Response/NativeResponse.php @@ -82,7 +82,7 @@ public function __construct(NativeClientState $multi, $context, string $url, arr /** * {@inheritdoc} */ - public function getInfo(string $type = null) + public function getInfo(?string $type = null) { if (!$info = $this->finalInfo) { $info = $this->info; @@ -232,7 +232,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) { diff --git a/Response/StreamWrapper.php b/Response/StreamWrapper.php index 50a7c36..1c7a2ee 100644 --- a/Response/StreamWrapper.php +++ b/Response/StreamWrapper.php @@ -47,7 +47,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); diff --git a/Response/TraceableResponse.php b/Response/TraceableResponse.php index 3bf1571..68a8dee 100644 --- a/Response/TraceableResponse.php +++ b/Response/TraceableResponse.php @@ -36,7 +36,7 @@ class TraceableResponse implements ResponseInterface, StreamableInterface private $content; private $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 @@ public function cancel(): void } } - public function getInfo(string $type = null) + public function getInfo(?string $type = null) { return $this->response->getInfo($type); } diff --git a/Response/TransportResponseTrait.php b/Response/TransportResponseTrait.php index 0482ccb..6d5ae50 100644 --- a/Response/TransportResponseTrait.php +++ b/Response/TransportResponseTrait.php @@ -146,7 +146,7 @@ private function doDestruct() * * @internal */ - public static function stream(iterable $responses, float $timeout = null): \Generator + public static function stream(iterable $responses, ?float $timeout = null): \Generator { $runningResponses = []; diff --git a/RetryableHttpClient.php b/RetryableHttpClient.php index bec1378..ae025e4 100644 --- a/RetryableHttpClient.php +++ b/RetryableHttpClient.php @@ -39,7 +39,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(); diff --git a/ScopingHttpClient.php b/ScopingHttpClient.php index 85fa26a..402bc87 100644 --- a/ScopingHttpClient.php +++ b/ScopingHttpClient.php @@ -32,7 +32,7 @@ class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAw private $defaultOptionsByRegexp; private $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 @@ public function __construct(HttpClientInterface $client, array $defaultOptionsBy } } - 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 { if (null === $regexp) { $regexp = preg_quote(implode('', self::resolveUrl(self::parseUrl('.'), self::parseUrl($baseUri)))); @@ -96,7 +96,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { return $this->client->stream($responses, $timeout); } diff --git a/Tests/AsyncDecoratorTraitTest.php b/Tests/AsyncDecoratorTraitTest.php index 199d2cf..1f55296 100644 --- a/Tests/AsyncDecoratorTraitTest.php +++ b/Tests/AsyncDecoratorTraitTest.php @@ -25,7 +25,7 @@ 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 @@ protected function getHttpClient(string $testCase, \Closure $chunkFilter = null, private $chunkFilter; - public function __construct(HttpClientInterface $client, \Closure $chunkFilter = null) + public function __construct(HttpClientInterface $client, ?\Closure $chunkFilter = null) { $this->chunkFilter = $chunkFilter; $this->client = $client; diff --git a/TraceableHttpClient.php b/TraceableHttpClient.php index 76c9282..0c1f05a 100644 --- a/TraceableHttpClient.php +++ b/TraceableHttpClient.php @@ -30,7 +30,7 @@ final class TraceableHttpClient implements HttpClientInterface, ResetInterface, private $stopwatch; private $tracedRequests; - public function __construct(HttpClientInterface $client, Stopwatch $stopwatch = null) + public function __construct(HttpClientInterface $client, ?Stopwatch $stopwatch = null) { $this->client = $client; $this->stopwatch = $stopwatch; @@ -72,7 +72,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream($responses, float $timeout = null): ResponseStreamInterface + public function stream($responses, ?float $timeout = null): ResponseStreamInterface { if ($responses instanceof TraceableResponse) { $responses = [$responses];