diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a30a02..3df289a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: run: composer install --no-interaction --no-progress --no-scripts --ansi - name: php-cs-fixer - run: vendor/bin/php-cs-fixer fix --dry-run --ansi + run: vendor/bin/php-cs-fixer fix --dry-run --ansi -v phpspec: name: PHPSpec diff --git a/src/Http/HttpMessageHelper.php b/src/Http/HttpMessageHelper.php index 95ff49f..52b3d58 100644 --- a/src/Http/HttpMessageHelper.php +++ b/src/Http/HttpMessageHelper.php @@ -24,7 +24,7 @@ public static function formatHeadersForSpanAttribute(array $headers): string $values = [$values]; } foreach ($values as $value) { - $lines[] = sprintf('%s: %s', mb_strtolower($name), $value); + $lines[] = \sprintf('%s: %s', mb_strtolower($name), $value); } } @@ -34,7 +34,7 @@ public static function formatHeadersForSpanAttribute(array $headers): string /** * @param array $headers */ - public static function getContentType(array $headers): ?string + public static function getContentType(array $headers): string|null { $headers = HttpSensitiveDataHelper::filterHeaders($headers); diff --git a/src/Http/TracedResponse.php b/src/Http/TracedResponse.php index 61965d2..7a05729 100644 --- a/src/Http/TracedResponse.php +++ b/src/Http/TracedResponse.php @@ -87,7 +87,7 @@ public function cancel(): void } } - public function getInfo(string $type = null): mixed + public function getInfo(string|null $type = null): mixed { return $this->response->getInfo($type); } @@ -123,7 +123,7 @@ public static function stream(HttpClientInterface $client, iterable $responses, foreach ($responses as $r) { if (!$r instanceof self) { - throw new \TypeError(sprintf('"%s::stream()" expects parameter 1 to be an iterable of TracedResponse objects, "%s" given.', TracingHttpClient::class, get_debug_type($r))); + throw new \TypeError(\sprintf('"%s::stream()" expects parameter 1 to be an iterable of TracedResponse objects, "%s" given.', TracingHttpClient::class, get_debug_type($r))); } $traceableMap[$r->response] = $r; diff --git a/src/Http/TracingHttpClient.php b/src/Http/TracingHttpClient.php index 0db8472..f6b2c5f 100644 --- a/src/Http/TracingHttpClient.php +++ b/src/Http/TracingHttpClient.php @@ -39,9 +39,7 @@ class TracingHttpClient implements HttpClientInterface * @param HttpClientInterface|array|null $client */ final public function __construct( - HttpClientInterface|array $client = null, - ClientRequestOperationNameResolverInterface $operationNameResolver = null, - ClientRequestAttributeProviderInterface $attributeProvider = null, + HttpClientInterface|array|null $client = null, ClientRequestOperationNameResolverInterface|null $operationNameResolver = null, ClientRequestAttributeProviderInterface|null $attributeProvider = null, int $maxHostConnections = 6, int $maxPendingPushes = 50, ) { @@ -71,7 +69,7 @@ protected function getExtraSpanAttributes(array|null $attributes): array } if (!\is_array($attributes)) { - throw new \RuntimeException(sprintf('Extra span attributes must be a comma separated list of attributes or an array. %s given.', get_debug_type($attributes))); + throw new \RuntimeException(\sprintf('Extra span attributes must be a comma separated list of attributes or an array. %s given.', get_debug_type($attributes))); } return $attributes; @@ -91,6 +89,7 @@ protected function getExtraSpanAttributes(array|null $attributes): array * on_response_body_callback?: callable|array * } * } $options + * * @throws TransportExceptionInterface */ public function request(string $method, string $url, array $options = []): ResponseInterface @@ -166,7 +165,7 @@ public function request(string $method, string $url, array $options = []): Respo return new TracedResponse($this->client->request($method, $url, $options), $span); } - public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface + public function stream(ResponseInterface|iterable $responses, float|null $timeout = null): ResponseStreamInterface { if ($responses instanceof ResponseInterface) { $responses = [$responses];