Skip to content

Commit 0341e41

Browse files
CS fixes
1 parent 95f9645 commit 0341e41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+111
-111
lines changed

BinaryFileResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ public function prepare(Request $request): static
259259
$end = min($end, $fileSize - 1);
260260
if ($start < 0 || $start > $end) {
261261
$this->setStatusCode(416);
262-
$this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize));
262+
$this->headers->set('Content-Range', \sprintf('bytes */%s', $fileSize));
263263
} elseif ($end - $start < $fileSize - 1) {
264264
$this->maxlen = $end < $fileSize ? $end - $start + 1 : -1;
265265
$this->offset = $start;
266266

267267
$this->setStatusCode(206);
268-
$this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize));
268+
$this->headers->set('Content-Range', \sprintf('bytes %s-%s/%s', $start, $end, $fileSize));
269269
$this->headers->set('Content-Length', $end - $start + 1);
270270
}
271271
}

Cookie.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function __construct(string $name, ?string $value = null, int|string|\Dat
101101
{
102102
// from PHP source code
103103
if ($raw && false !== strpbrk($name, self::RESERVED_CHARS_LIST)) {
104-
throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name));
104+
throw new \InvalidArgumentException(\sprintf('The cookie name "%s" contains invalid characters.', $name));
105105
}
106106

107107
if (empty($name)) {
@@ -211,7 +211,7 @@ public function withHttpOnly(bool $httpOnly = true): static
211211
public function withRaw(bool $raw = true): static
212212
{
213213
if ($raw && false !== strpbrk($this->name, self::RESERVED_CHARS_LIST)) {
214-
throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $this->name));
214+
throw new \InvalidArgumentException(\sprintf('The cookie name "%s" contains invalid characters.', $this->name));
215215
}
216216

217217
$cookie = clone $this;

File/Exception/AccessDeniedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class AccessDeniedException extends FileException
2020
{
2121
public function __construct(string $path)
2222
{
23-
parent::__construct(sprintf('The file %s could not be accessed', $path));
23+
parent::__construct(\sprintf('The file %s could not be accessed', $path));
2424
}
2525
}

File/Exception/FileNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class FileNotFoundException extends FileException
2020
{
2121
public function __construct(string $path)
2222
{
23-
parent::__construct(sprintf('The file "%s" does not exist', $path));
23+
parent::__construct(\sprintf('The file "%s" does not exist', $path));
2424
}
2525
}

File/Exception/UnexpectedTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class UnexpectedTypeException extends FileException
1515
{
1616
public function __construct(mixed $value, string $expectedType)
1717
{
18-
parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, get_debug_type($value)));
18+
parent::__construct(\sprintf('Expected argument of type %s, %s given', $expectedType, get_debug_type($value)));
1919
}
2020
}

File/File.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function move(string $directory, ?string $name = null): self
9393
restore_error_handler();
9494
}
9595
if (!$renamed) {
96-
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
96+
throw new FileException(\sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
9797
}
9898

9999
@chmod($target, 0666 & ~umask());
@@ -106,7 +106,7 @@ public function getContent(): string
106106
$content = file_get_contents($this->getPathname());
107107

108108
if (false === $content) {
109-
throw new FileException(sprintf('Could not get the content of the file "%s".', $this->getPathname()));
109+
throw new FileException(\sprintf('Could not get the content of the file "%s".', $this->getPathname()));
110110
}
111111

112112
return $content;
@@ -116,10 +116,10 @@ protected function getTargetFile(string $directory, ?string $name = null): self
116116
{
117117
if (!is_dir($directory)) {
118118
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
119-
throw new FileException(sprintf('Unable to create the "%s" directory.', $directory));
119+
throw new FileException(\sprintf('Unable to create the "%s" directory.', $directory));
120120
}
121121
} elseif (!is_writable($directory)) {
122-
throw new FileException(sprintf('Unable to write in the "%s" directory.', $directory));
122+
throw new FileException(\sprintf('Unable to write in the "%s" directory.', $directory));
123123
}
124124

125125
$target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));

File/UploadedFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function move(string $directory, ?string $name = null): File
174174
restore_error_handler();
175175
}
176176
if (!$moved) {
177-
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
177+
throw new FileException(\sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
178178
}
179179

180180
@chmod($target, 0666 & ~umask());
@@ -264,6 +264,6 @@ public function getErrorMessage(): string
264264
$maxFilesize = \UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
265265
$message = $errors[$errorCode] ?? 'The file "%s" was not uploaded due to an unknown error.';
266266

267-
return sprintf($message, $this->getClientOriginalName(), $maxFilesize);
267+
return \sprintf($message, $this->getClientOriginalName(), $maxFilesize);
268268
}
269269
}

HeaderBag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __toString(): string
5151
foreach ($headers as $name => $values) {
5252
$name = ucwords($name, '-');
5353
foreach ($values as $value) {
54-
$content .= sprintf("%-{$max}s %s\r\n", $name.':', $value);
54+
$content .= \sprintf("%-{$max}s %s\r\n", $name.':', $value);
5555
}
5656
}
5757

@@ -204,7 +204,7 @@ public function getDate(string $key, ?\DateTimeInterface $default = null): ?\Dat
204204
}
205205

206206
if (false === $date = \DateTimeImmutable::createFromFormat(\DATE_RFC2822, $value)) {
207-
throw new \RuntimeException(sprintf('The "%s" HTTP header is not parseable (%s).', $key, $value));
207+
throw new \RuntimeException(\sprintf('The "%s" HTTP header is not parseable (%s).', $key, $value));
208208
}
209209

210210
return $date;

HeaderUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public static function unquote(string $s): string
165165
public static function makeDisposition(string $disposition, string $filename, string $filenameFallback = ''): string
166166
{
167167
if (!\in_array($disposition, [self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE])) {
168-
throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE));
168+
throw new \InvalidArgumentException(\sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE));
169169
}
170170

171171
if ('' === $filenameFallback) {

InputBag.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ final class InputBag extends ParameterBag
2929
public function get(string $key, mixed $default = null): string|int|float|bool|null
3030
{
3131
if (null !== $default && !\is_scalar($default) && !$default instanceof \Stringable) {
32-
throw new \InvalidArgumentException(sprintf('Expected a scalar value as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($default)));
32+
throw new \InvalidArgumentException(\sprintf('Expected a scalar value as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($default)));
3333
}
3434

3535
$value = parent::get($key, $this);
3636

3737
if (null !== $value && $this !== $value && !\is_scalar($value) && !$value instanceof \Stringable) {
38-
throw new BadRequestException(sprintf('Input value "%s" contains a non-scalar value.', $key));
38+
throw new BadRequestException(\sprintf('Input value "%s" contains a non-scalar value.', $key));
3939
}
4040

4141
return $this === $value ? $default : $value;
@@ -68,7 +68,7 @@ public function add(array $inputs = []): void
6868
public function set(string $key, mixed $value): void
6969
{
7070
if (null !== $value && !\is_scalar($value) && !\is_array($value) && !$value instanceof \Stringable) {
71-
throw new \InvalidArgumentException(sprintf('Expected a scalar, or an array as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($value)));
71+
throw new \InvalidArgumentException(\sprintf('Expected a scalar, or an array as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($value)));
7272
}
7373

7474
$this->parameters[$key] = $value;
@@ -112,11 +112,11 @@ public function filter(string $key, mixed $default = null, int $filter = \FILTER
112112
}
113113

114114
if (\is_array($value) && !(($options['flags'] ?? 0) & (\FILTER_REQUIRE_ARRAY | \FILTER_FORCE_ARRAY))) {
115-
throw new BadRequestException(sprintf('Input value "%s" contains an array, but "FILTER_REQUIRE_ARRAY" or "FILTER_FORCE_ARRAY" flags were not set.', $key));
115+
throw new BadRequestException(\sprintf('Input value "%s" contains an array, but "FILTER_REQUIRE_ARRAY" or "FILTER_FORCE_ARRAY" flags were not set.', $key));
116116
}
117117

118118
if ((\FILTER_CALLBACK & $filter) && !(($options['options'] ?? null) instanceof \Closure)) {
119-
throw new \InvalidArgumentException(sprintf('A Closure must be passed to "%s()" when FILTER_CALLBACK is used, "%s" given.', __METHOD__, get_debug_type($options['options'] ?? null)));
119+
throw new \InvalidArgumentException(\sprintf('A Closure must be passed to "%s()" when FILTER_CALLBACK is used, "%s" given.', __METHOD__, get_debug_type($options['options'] ?? null)));
120120
}
121121

122122
$options['flags'] ??= 0;

0 commit comments

Comments
 (0)