Skip to content

Commit 63f320d

Browse files
CS fixes
1 parent 54e8431 commit 63f320d

File tree

57 files changed

+166
-166
lines changed

Some content is hidden

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

57 files changed

+166
-166
lines changed

Attribute/WithLogLevel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class WithLogLevel
2525
public function __construct(public readonly string $level)
2626
{
2727
if (!\defined('Psr\Log\LogLevel::'.strtoupper($this->level))) {
28-
throw new \InvalidArgumentException(sprintf('Invalid log level "%s".', $this->level));
28+
throw new \InvalidArgumentException(\sprintf('Invalid log level "%s".', $this->level));
2929
}
3030
}
3131
}

Bundle/Bundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ public function getContainerExtension(): ?ExtensionInterface
7070

7171
if (null !== $extension) {
7272
if (!$extension instanceof ExtensionInterface) {
73-
throw new \LogicException(sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_debug_type($extension)));
73+
throw new \LogicException(\sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_debug_type($extension)));
7474
}
7575

7676
// check naming convention
7777
$basename = preg_replace('/Bundle$/', '', $this->getName());
7878
$expectedAlias = Container::underscore($basename);
7979

8080
if ($expectedAlias != $extension->getAlias()) {
81-
throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias()));
81+
throw new \LogicException(\sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias()));
8282
}
8383

8484
$this->extension = $extension;

CacheClearer/Psr6CacheClearer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function hasPool(string $name): bool
3939
public function getPool(string $name): CacheItemPoolInterface
4040
{
4141
if (!$this->hasPool($name)) {
42-
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
42+
throw new \InvalidArgumentException(\sprintf('Cache pool not found: "%s".', $name));
4343
}
4444

4545
return $this->pools[$name];
@@ -51,7 +51,7 @@ public function getPool(string $name): CacheItemPoolInterface
5151
public function clearPool(string $name): bool
5252
{
5353
if (!isset($this->pools[$name])) {
54-
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
54+
throw new \InvalidArgumentException(\sprintf('Cache pool not found: "%s".', $name));
5555
}
5656

5757
return $this->pools[$name]->clear();

CacheWarmer/CacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ protected function writeCacheFile(string $file, $content)
3030
return;
3131
}
3232

33-
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
33+
throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $file));
3434
}
3535
}

CacheWarmer/CacheWarmerAggregate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ public function warmUp(string $cacheDir, string|SymfonyStyle|null $buildDir = nu
107107
$start = microtime(true);
108108
foreach ((array) $warmer->warmUp($cacheDir, $buildDir) as $item) {
109109
if (is_dir($item) || (str_starts_with($item, \dirname($cacheDir)) && !is_file($item)) || ($buildDir && str_starts_with($item, \dirname($buildDir)) && !is_file($item))) {
110-
throw new \LogicException(sprintf('"%s::warmUp()" should return a list of files or classes but "%s" is none of them.', $warmer::class, $item));
110+
throw new \LogicException(\sprintf('"%s::warmUp()" should return a list of files or classes but "%s" is none of them.', $warmer::class, $item));
111111
}
112112
$preload[] = $item;
113113
}
114114

115115
if ($io?->isDebug()) {
116-
$io->info(sprintf('"%s" completed in %0.2fms.', $warmer::class, 1000 * (microtime(true) - $start)));
116+
$io->info(\sprintf('"%s" completed in %0.2fms.', $warmer::class, 1000 * (microtime(true) - $start)));
117117
}
118118
}
119119
} finally {

Controller/ArgumentResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getArguments(Request $request, callable $controller, ?\Reflectio
6060
if ($attribute->disabled) {
6161
$disabledResolvers[$attribute->resolver] = true;
6262
} elseif ($resolverName) {
63-
throw new \LogicException(sprintf('You can only pin one resolver per argument, but argument "$%s" of "%s()" has more.', $metadata->getName(), $this->getPrettyName($controller)));
63+
throw new \LogicException(\sprintf('You can only pin one resolver per argument, but argument "$%s" of "%s()" has more.', $metadata->getName(), $this->getPrettyName($controller)));
6464
} else {
6565
$resolverName = $attribute->resolver;
6666
}
@@ -94,7 +94,7 @@ public function getArguments(Request $request, callable $controller, ?\Reflectio
9494
}
9595

9696
if (1 < $count && !$metadata->isVariadic()) {
97-
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at most one value for non-variadic arguments.', get_debug_type($resolver)));
97+
throw new \InvalidArgumentException(\sprintf('"%s::resolve()" must yield at most one value for non-variadic arguments.', get_debug_type($resolver)));
9898
}
9999

100100
if ($count) {
@@ -103,11 +103,11 @@ public function getArguments(Request $request, callable $controller, ?\Reflectio
103103
}
104104

105105
if (!$resolver instanceof ValueResolverInterface) {
106-
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at least one value.', get_debug_type($resolver)));
106+
throw new \InvalidArgumentException(\sprintf('"%s::resolve()" must yield at least one value.', get_debug_type($resolver)));
107107
}
108108
}
109109

110-
throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or there is a non-optional argument after this one.', $this->getPrettyName($controller), $metadata->getName()));
110+
throw new \RuntimeException(\sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or there is a non-optional argument after this one.', $this->getPrettyName($controller), $metadata->getName()));
111111
}
112112

113113
return $arguments;

Controller/ArgumentResolver/BackedEnumValueResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable
7878
}
7979

8080
if (!\is_int($value) && !\is_string($value)) {
81-
throw new \LogicException(sprintf('Could not resolve the "%s $%s" controller argument: expecting an int or string, got "%s".', $argument->getType(), $argument->getName(), get_debug_type($value)));
81+
throw new \LogicException(\sprintf('Could not resolve the "%s $%s" controller argument: expecting an int or string, got "%s".', $argument->getType(), $argument->getName(), get_debug_type($value)));
8282
}
8383

8484
/** @var class-string<\BackedEnum> $enumType */
@@ -87,7 +87,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable
8787
try {
8888
return [$enumType::from($value)];
8989
} catch (\ValueError|\TypeError $e) {
90-
throw new NotFoundHttpException(sprintf('Could not resolve the "%s $%s" controller argument: ', $argument->getType(), $argument->getName()).$e->getMessage(), $e);
90+
throw new NotFoundHttpException(\sprintf('Could not resolve the "%s $%s" controller argument: ', $argument->getType(), $argument->getName()).$e->getMessage(), $e);
9191
}
9292
}
9393
}

Controller/ArgumentResolver/DateTimeValueResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
9090
}
9191

9292
if (!$date) {
93-
throw new NotFoundHttpException(sprintf('Invalid date given for parameter "%s".', $argument->getName()));
93+
throw new NotFoundHttpException(\sprintf('Invalid date given for parameter "%s".', $argument->getName()));
9494
}
9595

9696
return [$date];

Controller/ArgumentResolver/NotTaggedControllerValueResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
8282
return [];
8383
}
8484

85-
$what = sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
86-
$message = sprintf('Could not resolve %s, maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?', $what);
85+
$what = \sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
86+
$message = \sprintf('Could not resolve %s, maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?', $what);
8787

8888
throw new RuntimeException($message);
8989
}

Controller/ArgumentResolver/QueryParameterValueResolver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
3838
return [];
3939
}
4040

41-
throw new NotFoundHttpException(sprintf('Missing query parameter "%s".', $name));
41+
throw new NotFoundHttpException(\sprintf('Missing query parameter "%s".', $name));
4242
}
4343

4444
$value = $request->query->all()[$name];
@@ -52,7 +52,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
5252
$filtered = array_values(array_filter((array) $value, \is_array(...)));
5353

5454
if ($filtered !== $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
55-
throw new NotFoundHttpException(sprintf('Invalid query parameter "%s".', $name));
55+
throw new NotFoundHttpException(\sprintf('Invalid query parameter "%s".', $name));
5656
}
5757

5858
return $filtered;
@@ -80,8 +80,8 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
8080
default => match ($enumType = is_subclass_of($type, \BackedEnum::class) ? (new \ReflectionEnum($type))->getBackingType()->getName() : null) {
8181
'int' => \FILTER_VALIDATE_INT,
8282
'string' => \FILTER_DEFAULT,
83-
default => throw new \LogicException(sprintf('#[MapQueryParameter] cannot be used on controller argument "%s$%s" of type "%s"; one of array, string, int, float, bool or \BackedEnum should be used.', $argument->isVariadic() ? '...' : '', $argument->getName(), $type ?? 'mixed')),
84-
}
83+
default => throw new \LogicException(\sprintf('#[MapQueryParameter] cannot be used on controller argument "%s$%s" of type "%s"; one of array, string, int, float, bool or \BackedEnum should be used.', $argument->isVariadic() ? '...' : '', $argument->getName(), $type ?? 'mixed')),
84+
},
8585
};
8686

8787
$value = filter_var($value, $attribute->filter ?? $filter, $options);
@@ -103,7 +103,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
103103
}
104104

105105
if (null === $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
106-
throw new NotFoundHttpException(sprintf('Invalid query parameter "%s".', $name));
106+
throw new NotFoundHttpException(\sprintf('Invalid query parameter "%s".', $name));
107107
}
108108

109109
if (!\is_array($value)) {
@@ -117,7 +117,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
117117
}
118118

119119
if ($filtered !== $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
120-
throw new NotFoundHttpException(sprintf('Invalid query parameter "%s".', $name));
120+
throw new NotFoundHttpException(\sprintf('Invalid query parameter "%s".', $name));
121121
}
122122

123123
return $argument->isVariadic() ? $filtered : [$filtered];

0 commit comments

Comments
 (0)