Skip to content

Commit

Permalink
feat(Common): cs-fixer ><
Browse files Browse the repository at this point in the history
  • Loading branch information
neiluJ committed Dec 11, 2024
1 parent 9fa7189 commit 0c73dc9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Http/HttpMessageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -34,7 +34,7 @@ public static function formatHeadersForSpanAttribute(array $headers): string
/**
* @param array<string,string|string[]> $headers
*/
public static function getContentType(array $headers): ?string
public static function getContentType(array $headers): string|null
{
$headers = HttpSensitiveDataHelper::filterHeaders($headers);

Expand Down
4 changes: 2 additions & 2 deletions src/Http/TracedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 4 additions & 5 deletions src/Http/TracingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ class TracingHttpClient implements HttpClientInterface
* @param HttpClientInterface|array<mixed>|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,
) {
Expand Down Expand Up @@ -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;
Expand All @@ -91,6 +89,7 @@ protected function getExtraSpanAttributes(array|null $attributes): array
* on_response_body_callback?: callable|array<string|object, string>
* }
* } $options
*
* @throws TransportExceptionInterface
*/
public function request(string $method, string $url, array $options = []): ResponseInterface
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 0c73dc9

Please sign in to comment.