Skip to content

Commit 3537d17

Browse files
CS fixes
1 parent ce95f3e commit 3537d17

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

AbstractBrowser.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function getCookieJar(): CookieJar
204204
*/
205205
public function getCrawler(): Crawler
206206
{
207-
return $this->crawler ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
207+
return $this->crawler ?? throw new BadMethodCallException(\sprintf('The "request()" method must be called before "%s()".', __METHOD__));
208208
}
209209

210210
/**
@@ -224,7 +224,7 @@ public function useHtml5Parser(bool $useHtml5Parser): static
224224
*/
225225
public function getInternalResponse(): Response
226226
{
227-
return $this->internalResponse ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
227+
return $this->internalResponse ?? throw new BadMethodCallException(\sprintf('The "request()" method must be called before "%s()".', __METHOD__));
228228
}
229229

230230
/**
@@ -237,15 +237,15 @@ public function getInternalResponse(): Response
237237
*/
238238
public function getResponse(): object
239239
{
240-
return $this->response ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
240+
return $this->response ?? throw new BadMethodCallException(\sprintf('The "request()" method must be called before "%s()".', __METHOD__));
241241
}
242242

243243
/**
244244
* Returns the current BrowserKit Request instance.
245245
*/
246246
public function getInternalRequest(): Request
247247
{
248-
return $this->internalRequest ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
248+
return $this->internalRequest ?? throw new BadMethodCallException(\sprintf('The "request()" method must be called before "%s()".', __METHOD__));
249249
}
250250

251251
/**
@@ -258,7 +258,7 @@ public function getInternalRequest(): Request
258258
*/
259259
public function getRequest(): object
260260
{
261-
return $this->request ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
261+
return $this->request ?? throw new BadMethodCallException(\sprintf('The "request()" method must be called before "%s()".', __METHOD__));
262262
}
263263

264264
/**
@@ -287,7 +287,7 @@ public function clickLink(string $linkText/* , array $serverParameters = [] */):
287287
{
288288
$serverParameters = 1 < \func_num_args() ? func_get_arg(1) : [];
289289

290-
$crawler = $this->crawler ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
290+
$crawler = $this->crawler ?? throw new BadMethodCallException(\sprintf('The "request()" method must be called before "%s()".', __METHOD__));
291291

292292
return $this->click($crawler->selectLink($linkText)->link(), $serverParameters);
293293
}
@@ -316,11 +316,11 @@ public function submit(Form $form, array $values = [], array $serverParameters =
316316
*/
317317
public function submitForm(string $button, array $fieldValues = [], string $method = 'POST', array $serverParameters = []): Crawler
318318
{
319-
$crawler = $this->crawler ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
319+
$crawler = $this->crawler ?? throw new BadMethodCallException(\sprintf('The "request()" method must be called before "%s()".', __METHOD__));
320320
$buttonNode = $crawler->selectButton($button);
321321

322322
if (0 === $buttonNode->count()) {
323-
throw new InvalidArgumentException(sprintf('There is no button with "%s" as its content, id, value or name.', $button));
323+
throw new InvalidArgumentException(\sprintf('There is no button with "%s" as its content, id, value or name.', $button));
324324
}
325325

326326
$form = $buttonNode->form($fieldValues, $method);
@@ -444,7 +444,7 @@ protected function doRequestInProcess(object $request)
444444
}
445445

446446
if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) {
447-
throw new RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s.', $process->getOutput(), $process->getErrorOutput()));
447+
throw new RuntimeException(\sprintf('OUTPUT: %s ERROR OUTPUT: %s.', $process->getOutput(), $process->getErrorOutput()));
448448
}
449449

450450
return unserialize($process->getOutput());
@@ -554,7 +554,7 @@ public function followRedirect(): Crawler
554554
if (-1 !== $this->maxRedirects) {
555555
if ($this->redirectCount > $this->maxRedirects) {
556556
$this->redirectCount = 0;
557-
throw new LogicException(sprintf('The maximum number (%d) of redirections was reached.', $this->maxRedirects));
557+
throw new LogicException(\sprintf('The maximum number (%d) of redirections was reached.', $this->maxRedirects));
558558
}
559559
}
560560

@@ -630,7 +630,7 @@ protected function getAbsoluteUri(string $uri): string
630630
if (!$this->history->isEmpty()) {
631631
$currentUri = $this->history->current()->getUri();
632632
} else {
633-
$currentUri = sprintf('http%s://%s/',
633+
$currentUri = \sprintf('http%s://%s/',
634634
isset($this->server['HTTPS']) ? 's' : '',
635635
$this->server['HTTP_HOST'] ?? 'localhost'
636636
);

Cookie.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __construct(string $name, ?string $value, ?string $expires = nul
7777
if (null !== $expires) {
7878
$timestampAsDateTime = \DateTimeImmutable::createFromFormat('U', $expires);
7979
if (false === $timestampAsDateTime) {
80-
throw new UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.', $expires));
80+
throw new UnexpectedValueException(\sprintf('The cookie expiration time "%s" is not valid.', $expires));
8181
}
8282

8383
$this->expires = $timestampAsDateTime->format('U');
@@ -89,7 +89,7 @@ public function __construct(string $name, ?string $value, ?string $expires = nul
8989
*/
9090
public function __toString(): string
9191
{
92-
$cookie = sprintf('%s=%s', $this->name, $this->rawValue);
92+
$cookie = \sprintf('%s=%s', $this->name, $this->rawValue);
9393

9494
if (null !== $this->expires) {
9595
$dateTime = \DateTimeImmutable::createFromFormat('U', $this->expires, new \DateTimeZone('GMT'));
@@ -129,7 +129,7 @@ public static function fromString(string $cookie, ?string $url = null): static
129129
$parts = explode(';', $cookie);
130130

131131
if (!str_contains($parts[0], '=')) {
132-
throw new InvalidArgumentException(sprintf('The cookie string "%s" is not valid.', $parts[0]));
132+
throw new InvalidArgumentException(\sprintf('The cookie string "%s" is not valid.', $parts[0]));
133133
}
134134

135135
[$name, $value] = explode('=', array_shift($parts), 2);
@@ -148,7 +148,7 @@ public static function fromString(string $cookie, ?string $url = null): static
148148

149149
if (null !== $url) {
150150
if (false === ($urlParts = parse_url($url)) || !isset($urlParts['host'])) {
151-
throw new InvalidArgumentException(sprintf('The URL "%s" is not valid.', $url));
151+
throw new InvalidArgumentException(\sprintf('The URL "%s" is not valid.', $url));
152152
}
153153

154154
$values['domain'] = $urlParts['host'];

HttpBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class HttpBrowser extends AbstractBrowser
3232
public function __construct(?HttpClientInterface $client = null, ?History $history = null, ?CookieJar $cookieJar = null)
3333
{
3434
if (!$client && !class_exists(HttpClient::class)) {
35-
throw new LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
35+
throw new LogicException(\sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
3636
}
3737

3838
$this->client = $client ?? HttpClient::create();

Response.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ public function __toString(): string
4646
$headers = '';
4747
foreach ($this->headers as $name => $value) {
4848
if (\is_string($value)) {
49-
$headers .= sprintf("%s: %s\n", $name, $value);
49+
$headers .= \sprintf("%s: %s\n", $name, $value);
5050
} else {
5151
foreach ($value as $headerValue) {
52-
$headers .= sprintf("%s: %s\n", $name, $headerValue);
52+
$headers .= \sprintf("%s: %s\n", $name, $headerValue);
5353
}
5454
}
5555
}
@@ -104,7 +104,7 @@ public function toArray(): array
104104
}
105105

106106
if (!\is_array($content)) {
107-
throw new JsonException(sprintf('JSON content was expected to decode to an array, "%s" returned.', get_debug_type($content)));
107+
throw new JsonException(\sprintf('JSON content was expected to decode to an array, "%s" returned.', get_debug_type($content)));
108108
}
109109

110110
return $this->jsonData = $content;

Test/Constraint/BrowserCookieValueSame.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ public function __construct(string $name, string $value, bool $raw = false, stri
3333

3434
public function toString(): string
3535
{
36-
$str = sprintf('has cookie "%s"', $this->name);
36+
$str = \sprintf('has cookie "%s"', $this->name);
3737
if ('/' !== $this->path) {
38-
$str .= sprintf(' with path "%s"', $this->path);
38+
$str .= \sprintf(' with path "%s"', $this->path);
3939
}
4040
if ($this->domain) {
41-
$str .= sprintf(' for domain "%s"', $this->domain);
41+
$str .= \sprintf(' for domain "%s"', $this->domain);
4242
}
43-
$str .= sprintf(' with %svalue "%s"', $this->raw ? 'raw ' : '', $this->value);
43+
$str .= \sprintf(' with %svalue "%s"', $this->raw ? 'raw ' : '', $this->value);
4444

4545
return $str;
4646
}

Test/Constraint/BrowserHasCookie.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public function __construct(string $name, string $path = '/', ?string $domain =
2929

3030
public function toString(): string
3131
{
32-
$str = sprintf('has cookie "%s"', $this->name);
32+
$str = \sprintf('has cookie "%s"', $this->name);
3333
if ('/' !== $this->path) {
34-
$str .= sprintf(' with path "%s"', $this->path);
34+
$str .= \sprintf(' with path "%s"', $this->path);
3535
}
3636
if ($this->domain) {
37-
$str .= sprintf(' for domain "%s"', $this->domain);
37+
$str .= \sprintf(' for domain "%s"', $this->domain);
3838
}
3939

4040
return $str;

Tests/CookieJarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testUpdateFromSetCookieWithMultipleCookies()
9494
{
9595
$timestamp = time() + 3600;
9696
$date = gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
97-
$setCookies = [sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%1$s', $date)];
97+
$setCookies = [\sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%1$s', $date)];
9898

9999
$cookieJar = new CookieJar();
100100
$cookieJar->updateFromSetCookie($setCookies);

0 commit comments

Comments
 (0)