Skip to content

Commit b51fb6b

Browse files
CS fixes
1 parent 1f5234e commit b51fb6b

34 files changed

+127
-127
lines changed

Attribute/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(
4949
?string $format = null,
5050
?bool $utf8 = null,
5151
?bool $stateless = null,
52-
private ?string $env = null
52+
private ?string $env = null,
5353
) {
5454
if (\is_array($path)) {
5555
$this->localizedPaths = $path;

Exception/MissingMandatoryParametersException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(string $routeName = '', $missingParameters = null, $
3131
if (\is_array($missingParameters)) {
3232
$this->routeName = $routeName;
3333
$this->missingParameters = $missingParameters;
34-
$message = sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', $missingParameters), $routeName);
34+
$message = \sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', $missingParameters), $routeName);
3535
} else {
3636
trigger_deprecation('symfony/routing', '6.1', 'Construction of "%s" with an exception message is deprecated, provide the route name and an array of missing parameters instead.', __CLASS__);
3737
$message = $routeName;

Exception/RouteCircularReferenceException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class RouteCircularReferenceException extends RuntimeException
1515
{
1616
public function __construct(string $routeId, array $path)
1717
{
18-
parent::__construct(sprintf('Circular reference detected for route "%s", path: "%s".', $routeId, implode(' -> ', $path)));
18+
parent::__construct(\sprintf('Circular reference detected for route "%s", path: "%s".', $routeId, implode(' -> ', $path)));
1919
}
2020
}

Generator/CompiledUrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function generate(string $name, array $parameters = [], int $referenceTyp
4747
}
4848

4949
if (!isset($this->compiledRoutes[$name])) {
50-
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
50+
throw new RouteNotFoundException(\sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
5151
}
5252

5353
[$variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes, $deprecations] = $this->compiledRoutes[$name] + [6 => []];

Generator/Dumper/CompiledUrlGeneratorDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getCompiledAliases(): array
6969
}
7070

7171
if (null === $target = $routes->get($currentId)) {
72-
throw new RouteNotFoundException(sprintf('Target route "%s" for alias "%s" does not exist.', $currentId, $name));
72+
throw new RouteNotFoundException(\sprintf('Target route "%s" for alias "%s" does not exist.', $currentId, $name));
7373
}
7474

7575
$compiledTarget = $target->compile();
@@ -109,11 +109,11 @@ private function generateDeclaredRoutes(): string
109109
{
110110
$routes = '';
111111
foreach ($this->getCompiledRoutes() as $name => $properties) {
112-
$routes .= sprintf("\n '%s' => %s,", $name, CompiledUrlMatcherDumper::export($properties));
112+
$routes .= \sprintf("\n '%s' => %s,", $name, CompiledUrlMatcherDumper::export($properties));
113113
}
114114

115115
foreach ($this->getCompiledAliases() as $alias => $properties) {
116-
$routes .= sprintf("\n '%s' => %s,", $alias, CompiledUrlMatcherDumper::export($properties));
116+
$routes .= \sprintf("\n '%s' => %s,", $alias, CompiledUrlMatcherDumper::export($properties));
117117
}
118118

119119
return $routes;

Generator/UrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function generate(string $name, array $parameters = [], int $referenceTyp
131131
}
132132

133133
if (null === $route ??= $this->routes->get($name)) {
134-
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
134+
throw new RouteNotFoundException(\sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
135135
}
136136

137137
// the Route has a cache of its own and is not recompiled as long as it does not get modified

Loader/AttributeClassLoader.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function __construct($env = null)
9494
} elseif ($env instanceof \Stringable || \is_scalar($env)) {
9595
$this->env = (string) $env;
9696
} else {
97-
throw new \TypeError(__METHOD__.sprintf(': Parameter $env was expected to be a string or null, "%s" given.', get_debug_type($env)));
97+
throw new \TypeError(__METHOD__.\sprintf(': Parameter $env was expected to be a string or null, "%s" given.', get_debug_type($env)));
9898
}
9999
}
100100

@@ -114,12 +114,12 @@ public function setRouteAnnotationClass(string $class)
114114
public function load(mixed $class, ?string $type = null): RouteCollection
115115
{
116116
if (!class_exists($class)) {
117-
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
117+
throw new \InvalidArgumentException(\sprintf('Class "%s" does not exist.', $class));
118118
}
119119

120120
$class = new \ReflectionClass($class);
121121
if ($class->isAbstract()) {
122-
throw new \InvalidArgumentException(sprintf('Attributes from class "%s" cannot be read as it is abstract.', $class->getName()));
122+
throw new \InvalidArgumentException(\sprintf('Attributes from class "%s" cannot be read as it is abstract.', $class->getName()));
123123
}
124124

125125
$this->hasDeprecatedAnnotations = false;
@@ -144,7 +144,7 @@ public function load(mixed $class, ?string $type = null): RouteCollection
144144

145145
if (1 === $collection->count() - \count($routeNamesBefore)) {
146146
$newRouteName = current(array_diff(array_keys($collection->all()), $routeNamesBefore));
147-
if ($newRouteName !== $aliasName = sprintf('%s::%s', $class->name, $method->name)) {
147+
if ($newRouteName !== $aliasName = \sprintf('%s::%s', $class->name, $method->name)) {
148148
$collection->addAlias($aliasName, $newRouteName);
149149
}
150150
}
@@ -162,7 +162,7 @@ public function load(mixed $class, ?string $type = null): RouteCollection
162162
$collection->addAlias($class->name, $invokeRouteName);
163163
}
164164

165-
if ($invokeRouteName !== $aliasName = sprintf('%s::__invoke', $class->name)) {
165+
if ($invokeRouteName !== $aliasName = \sprintf('%s::__invoke', $class->name)) {
166166
$collection->addAlias($aliasName, $invokeRouteName);
167167
}
168168
}
@@ -195,7 +195,7 @@ protected function addRoute(RouteCollection $collection, object $annot, array $g
195195

196196
foreach ($requirements as $placeholder => $requirement) {
197197
if (\is_int($placeholder)) {
198-
throw new \InvalidArgumentException(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" of route "%s" in "%s::%s()"?', $placeholder, $requirement, $name, $class->getName(), $method->getName()));
198+
throw new \InvalidArgumentException(\sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" of route "%s" in "%s::%s()"?', $placeholder, $requirement, $name, $class->getName(), $method->getName()));
199199
}
200200
}
201201

@@ -219,11 +219,11 @@ protected function addRoute(RouteCollection $collection, object $annot, array $g
219219
$paths[$locale] = $prefix.$localePath;
220220
}
221221
} elseif ($missing = array_diff_key($prefix, $path)) {
222-
throw new \LogicException(sprintf('Route to "%s" is missing paths for locale(s) "%s".', $class->name.'::'.$method->name, implode('", "', array_keys($missing))));
222+
throw new \LogicException(\sprintf('Route to "%s" is missing paths for locale(s) "%s".', $class->name.'::'.$method->name, implode('", "', array_keys($missing))));
223223
} else {
224224
foreach ($path as $locale => $localePath) {
225225
if (!isset($prefix[$locale])) {
226-
throw new \LogicException(sprintf('Route to "%s" with locale "%s" is missing a corresponding prefix in class "%s".', $method->name, $locale, $class->name));
226+
throw new \LogicException(\sprintf('Route to "%s" with locale "%s" is missing a corresponding prefix in class "%s".', $method->name, $locale, $class->name));
227227
}
228228

229229
$paths[$locale] = $prefix[$locale].$localePath;
@@ -242,7 +242,7 @@ protected function addRoute(RouteCollection $collection, object $annot, array $g
242242
continue;
243243
}
244244
foreach ($paths as $locale => $path) {
245-
if (preg_match(sprintf('/\{%s(?:<.*?>)?\}/', preg_quote($param->name)), $path)) {
245+
if (preg_match(\sprintf('/\{%s(?:<.*?>)?\}/', preg_quote($param->name)), $path)) {
246246
if (\is_scalar($defaultValue = $param->getDefaultValue()) || null === $defaultValue) {
247247
$defaults[$param->name] = $defaultValue;
248248
} elseif ($defaultValue instanceof \BackedEnum) {
@@ -360,7 +360,7 @@ protected function getGlobals(\ReflectionClass $class)
360360

361361
foreach ($globals['requirements'] as $placeholder => $requirement) {
362362
if (\is_int($placeholder)) {
363-
throw new \InvalidArgumentException(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" in "%s"?', $placeholder, $requirement, $class->getName()));
363+
throw new \InvalidArgumentException(\sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" in "%s"?', $placeholder, $requirement, $class->getName()));
364364
}
365365
}
366366
}

Loader/AttributeFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function findClass(string $file): string|false
8282
$tokens = token_get_all(file_get_contents($file));
8383

8484
if (1 === \count($tokens) && \T_INLINE_HTML === $tokens[0][0]) {
85-
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forget to add the "<?php" start tag at the beginning of the file?', $file));
85+
throw new \InvalidArgumentException(\sprintf('The file "%s" does not contain PHP code. Did you forget to add the "<?php" start tag at the beginning of the file?', $file));
8686
}
8787

8888
$nsTokens = [\T_NS_SEPARATOR => true, \T_STRING => true];

Loader/Configurator/CollectionConfigurator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ final public function prefix(string|array $prefix): static
8484
if (null === $this->parentPrefixes) {
8585
// no-op
8686
} elseif ($missing = array_diff_key($this->parentPrefixes, $prefix)) {
87-
throw new \LogicException(sprintf('Collection "%s" is missing prefixes for locale(s) "%s".', $this->name, implode('", "', array_keys($missing))));
87+
throw new \LogicException(\sprintf('Collection "%s" is missing prefixes for locale(s) "%s".', $this->name, implode('", "', array_keys($missing))));
8888
} else {
8989
foreach ($prefix as $locale => $localePrefix) {
9090
if (!isset($this->parentPrefixes[$locale])) {
91-
throw new \LogicException(sprintf('Collection "%s" with locale "%s" is missing a corresponding prefix in its parent collection.', $this->name, $locale));
91+
throw new \LogicException(\sprintf('Collection "%s" with locale "%s" is missing a corresponding prefix in its parent collection.', $this->name, $locale));
9292
}
9393

9494
$prefix[$locale] = $this->parentPrefixes[$locale].$localePrefix;

Loader/Configurator/Traits/HostTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final protected function addHost(RouteCollection $routes, string|array $hosts):
3939
$routes->add($name.'.'.$locale, $localizedRoute, $priority);
4040
}
4141
} elseif (!isset($hosts[$locale])) {
42-
throw new \InvalidArgumentException(sprintf('Route "%s" with locale "%s" is missing a corresponding host in its parent collection.', $name, $locale));
42+
throw new \InvalidArgumentException(\sprintf('Route "%s" with locale "%s" is missing a corresponding host in its parent collection.', $name, $locale));
4343
} else {
4444
$route->setHost($hosts[$locale]);
4545
$route->setRequirement('_locale', preg_quote($locale));

0 commit comments

Comments
 (0)