Skip to content

Commit 6f2691f

Browse files
CS fixes
1 parent 19f11e7 commit 6f2691f

37 files changed

+146
-138
lines changed

AmpHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function reset(): void
166166
foreach ($pushedResponses as [$pushedUrl, $pushDeferred]) {
167167
$pushDeferred->fail(new CancelledException());
168168

169-
$this->logger?->debug(sprintf('Unused pushed response: "%s"', $pushedUrl));
169+
$this->logger?->debug(\sprintf('Unused pushed response: "%s"', $pushedUrl));
170170
}
171171
}
172172

CachingHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CachingHttpClient implements HttpClientInterface, ResetInterface
4242
public function __construct(HttpClientInterface $client, StoreInterface $store, array $defaultOptions = [])
4343
{
4444
if (!class_exists(HttpClientKernel::class)) {
45-
throw new \LogicException(sprintf('Using "%s" requires the HttpKernel component, try running "composer require symfony/http-kernel".', __CLASS__));
45+
throw new \LogicException(\sprintf('Using "%s" requires the HttpKernel component, try running "composer require symfony/http-kernel".', __CLASS__));
4646
}
4747

4848
$this->client = $client;

Chunk/ServerSentEvent.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ public function getArrayData(): array
8989
}
9090

9191
if ('' === $this->data) {
92-
throw new JsonException(sprintf('Server-Sent Event%s data is empty.', '' !== $this->id ? sprintf(' "%s"', $this->id) : ''));
92+
throw new JsonException(\sprintf('Server-Sent Event%s data is empty.', '' !== $this->id ? \sprintf(' "%s"', $this->id) : ''));
9393
}
9494

9595
try {
9696
$jsonData = json_decode($this->data, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
9797
} catch (\JsonException $e) {
98-
throw new JsonException(sprintf('Decoding Server-Sent Event%s failed: ', '' !== $this->id ? sprintf(' "%s"', $this->id) : '').$e->getMessage(), $e->getCode());
98+
throw new JsonException(\sprintf('Decoding Server-Sent Event%s failed: ', '' !== $this->id ? \sprintf(' "%s"', $this->id) : '').$e->getMessage(), $e->getCode());
9999
}
100100

101101
if (!\is_array($jsonData)) {
102-
throw new JsonException(sprintf('JSON content was expected to decode to an array, "%s" returned in Server-Sent Event%s.', get_debug_type($jsonData), '' !== $this->id ? sprintf(' "%s"', $this->id) : ''));
102+
throw new JsonException(\sprintf('JSON content was expected to decode to an array, "%s" returned in Server-Sent Event%s.', get_debug_type($jsonData), '' !== $this->id ? \sprintf(' "%s"', $this->id) : ''));
103103
}
104104

105105
return $this->jsonData = $jsonData;

CurlHttpClient.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ public function request(string $method, string $url, array $options = []): Respo
152152
if (\is_array($options['auth_ntlm'])) {
153153
$count = \count($options['auth_ntlm']);
154154
if ($count <= 0 || $count > 2) {
155-
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must contain 1 or 2 elements, %d given.', $count));
155+
throw new InvalidArgumentException(\sprintf('Option "auth_ntlm" must contain 1 or 2 elements, %d given.', $count));
156156
}
157157

158158
$options['auth_ntlm'] = implode(':', $options['auth_ntlm']);
159159
}
160160

161161
if (!\is_string($options['auth_ntlm'])) {
162-
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must be a string or an array, "%s" given.', get_debug_type($options['auth_ntlm'])));
162+
throw new InvalidArgumentException(\sprintf('Option "auth_ntlm" must be a string or an array, "%s" given.', get_debug_type($options['auth_ntlm'])));
163163
}
164164

165165
$curlopts[\CURLOPT_USERPWD] = $options['auth_ntlm'];
@@ -297,21 +297,21 @@ public function request(string $method, string $url, array $options = []): Respo
297297
unset($multi->pushedResponses[$url]);
298298

299299
if (self::acceptPushForRequest($method, $options, $pushedResponse)) {
300-
$this->logger?->debug(sprintf('Accepting pushed response: "%s %s"', $method, $url));
300+
$this->logger?->debug(\sprintf('Accepting pushed response: "%s %s"', $method, $url));
301301

302302
// Reinitialize the pushed response with request's options
303303
$ch = $pushedResponse->handle;
304304
$pushedResponse = $pushedResponse->response;
305305
$pushedResponse->__construct($multi, $url, $options, $this->logger);
306306
} else {
307-
$this->logger?->debug(sprintf('Rejecting pushed response: "%s"', $url));
307+
$this->logger?->debug(\sprintf('Rejecting pushed response: "%s"', $url));
308308
$pushedResponse = null;
309309
}
310310
}
311311

312312
if (!$pushedResponse) {
313313
$ch = curl_init();
314-
$this->logger?->info(sprintf('Request: "%s %s"', $method, $url));
314+
$this->logger?->info(\sprintf('Request: "%s %s"', $method, $url));
315315
$curlopts += [\CURLOPT_SHARE => $multi->share];
316316
}
317317

@@ -321,7 +321,7 @@ public function request(string $method, string $url, array $options = []): Respo
321321
}
322322
if (null !== $value && !curl_setopt($ch, $opt, $value) && \CURLOPT_CERTINFO !== $opt && (!\defined('CURLOPT_HEADEROPT') || \CURLOPT_HEADEROPT !== $opt)) {
323323
$constantName = $this->findConstantName($opt);
324-
throw new TransportException(sprintf('Curl option "%s" is not supported.', $constantName ?? $opt));
324+
throw new TransportException(\sprintf('Curl option "%s" is not supported.', $constantName ?? $opt));
325325
}
326326
}
327327

@@ -388,7 +388,7 @@ private static function readRequestBody(int $length, \Closure $body, string &$bu
388388
{
389389
if (!$eof && \strlen($buffer) < $length) {
390390
if (!\is_string($data = $body($length))) {
391-
throw new TransportException(sprintf('The return value of the "body" option callback must be a string, "%s" returned.', get_debug_type($data)));
391+
throw new TransportException(\sprintf('The return value of the "body" option callback must be a string, "%s" returned.', get_debug_type($data)));
392392
}
393393

394394
$buffer .= $data;
@@ -551,7 +551,7 @@ private function validateExtraCurlOptions(array $options): void
551551
foreach ($options as $opt => $optValue) {
552552
if (isset($curloptsToConfig[$opt])) {
553553
$constName = $this->findConstantName($opt) ?? $opt;
554-
throw new InvalidArgumentException(sprintf('Cannot set "%s" with "extra.curl", use option "%s" instead.', $constName, $curloptsToConfig[$opt]));
554+
throw new InvalidArgumentException(\sprintf('Cannot set "%s" with "extra.curl", use option "%s" instead.', $constName, $curloptsToConfig[$opt]));
555555
}
556556

557557
if (\in_array($opt, $methodOpts)) {
@@ -560,7 +560,7 @@ private function validateExtraCurlOptions(array $options): void
560560

561561
if (\in_array($opt, $curloptsToCheck)) {
562562
$constName = $this->findConstantName($opt) ?? $opt;
563-
throw new InvalidArgumentException(sprintf('Cannot set "%s" with "extra.curl".', $constName));
563+
throw new InvalidArgumentException(\sprintf('Cannot set "%s" with "extra.curl".', $constName));
564564
}
565565
}
566566
}

DataCollector/HttpClientDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ private function getCurlCommand(array $trace): ?string
233233
}
234234

235235
if (preg_match('/^> ([A-Z]+)/', $line, $match)) {
236-
$command[] = sprintf('--request %s', $match[1]);
237-
$command[] = sprintf('--url %s', escapeshellarg($url));
236+
$command[] = \sprintf('--request %s', $match[1]);
237+
$command[] = \sprintf('--url %s', escapeshellarg($url));
238238
continue;
239239
}
240240

@@ -252,7 +252,7 @@ private function escapePayload(string $payload): string
252252
{
253253
static $useProcess;
254254

255-
if ($useProcess ??= function_exists('proc_open') && class_exists(Process::class)) {
255+
if ($useProcess ??= \function_exists('proc_open') && class_exists(Process::class)) {
256256
return substr((new Process(['', $payload]))->getCommandLine(), 3);
257257
}
258258

EventSourceHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function connect(string $url, array $options = [], string $method = 'GET'
5353

5454
public function request(string $method, string $url, array $options = []): ResponseInterface
5555
{
56-
$state = new class() {
56+
$state = new class {
5757
public ?string $buffer = null;
5858
public ?string $lastEventId = null;
5959
public float $reconnectionTime;
@@ -110,7 +110,7 @@ public function request(string $method, string $url, array $options = []): Respo
110110
if (preg_match('/^text\/event-stream(;|$)/i', $context->getHeaders()['content-type'][0] ?? '')) {
111111
$state->buffer = '';
112112
} elseif (null !== $lastError || (null !== $state->buffer && 200 === $context->getStatusCode())) {
113-
throw new EventSourceException(sprintf('Response content-type is "%s" while "text/event-stream" was expected for "%s".', $context->getHeaders()['content-type'][0] ?? '', $context->getInfo('url')));
113+
throw new EventSourceException(\sprintf('Response content-type is "%s" while "text/event-stream" was expected for "%s".', $context->getHeaders()['content-type'][0] ?? '', $context->getInfo('url')));
114114
} else {
115115
$context->passthru();
116116
}

Exception/HttpExceptionTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(ResponseInterface $response)
2727
$this->response = $response;
2828
$code = $response->getInfo('http_code');
2929
$url = $response->getInfo('url');
30-
$message = sprintf('HTTP %d returned for "%s".', $code, $url);
30+
$message = \sprintf('HTTP %d returned for "%s".', $code, $url);
3131

3232
$httpCodeFound = false;
3333
$isJson = false;
@@ -37,7 +37,7 @@ public function __construct(ResponseInterface $response)
3737
break;
3838
}
3939

40-
$message = sprintf('%s returned for "%s".', $h, $url);
40+
$message = \sprintf('%s returned for "%s".', $h, $url);
4141
$httpCodeFound = true;
4242
}
4343

0 commit comments

Comments
 (0)