Re-dump autoloader and composer.lock

This commit is contained in:
Stephen Abello
2025-09-18 10:26:38 +02:00
parent 7e515e7216
commit edbe4974ac
613 changed files with 5661 additions and 4259 deletions

View File

@@ -25,7 +25,7 @@ final class WithLogLevel
public function __construct(public readonly string $level)
{
if (!\defined('Psr\Log\LogLevel::'.strtoupper($this->level))) {
throw new \InvalidArgumentException(sprintf('Invalid log level "%s".', $this->level));
throw new \InvalidArgumentException(\sprintf('Invalid log level "%s".', $this->level));
}
}
}

View File

@@ -70,7 +70,7 @@ abstract class Bundle implements BundleInterface
if (null !== $extension) {
if (!$extension instanceof ExtensionInterface) {
throw new \LogicException(sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_debug_type($extension)));
throw new \LogicException(\sprintf('Extension "%s" must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_debug_type($extension)));
}
// check naming convention
@@ -78,7 +78,7 @@ abstract class Bundle implements BundleInterface
$expectedAlias = Container::underscore($basename);
if ($expectedAlias != $extension->getAlias()) {
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()));
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()));
}
$this->extension = $extension;

View File

@@ -39,7 +39,7 @@ class Psr6CacheClearer implements CacheClearerInterface
public function getPool(string $name): CacheItemPoolInterface
{
if (!$this->hasPool($name)) {
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
throw new \InvalidArgumentException(\sprintf('Cache pool not found: "%s".', $name));
}
return $this->pools[$name];
@@ -51,7 +51,7 @@ class Psr6CacheClearer implements CacheClearerInterface
public function clearPool(string $name): bool
{
if (!isset($this->pools[$name])) {
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
throw new \InvalidArgumentException(\sprintf('Cache pool not found: "%s".', $name));
}
return $this->pools[$name]->clear();

View File

@@ -30,6 +30,6 @@ abstract class CacheWarmer implements CacheWarmerInterface
return;
}
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $file));
}
}

View File

@@ -107,13 +107,13 @@ class CacheWarmerAggregate implements CacheWarmerInterface
$start = microtime(true);
foreach ((array) $warmer->warmUp($cacheDir, $buildDir) as $item) {
if (is_dir($item) || (str_starts_with($item, \dirname($cacheDir)) && !is_file($item)) || ($buildDir && str_starts_with($item, \dirname($buildDir)) && !is_file($item))) {
throw new \LogicException(sprintf('"%s::warmUp()" should return a list of files or classes but "%s" is none of them.', $warmer::class, $item));
throw new \LogicException(\sprintf('"%s::warmUp()" should return a list of files or classes but "%s" is none of them.', $warmer::class, $item));
}
$preload[] = $item;
}
if ($io?->isDebug()) {
$io->info(sprintf('"%s" completed in %0.2fms.', $warmer::class, 1000 * (microtime(true) - $start)));
$io->info(\sprintf('"%s" completed in %0.2fms.', $warmer::class, 1000 * (microtime(true) - $start)));
}
}
} finally {

View File

@@ -60,7 +60,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
if ($attribute->disabled) {
$disabledResolvers[$attribute->resolver] = true;
} elseif ($resolverName) {
throw new \LogicException(sprintf('You can only pin one resolver per argument, but argument "$%s" of "%s()" has more.', $metadata->getName(), $this->getPrettyName($controller)));
throw new \LogicException(\sprintf('You can only pin one resolver per argument, but argument "$%s" of "%s()" has more.', $metadata->getName(), $this->getPrettyName($controller)));
} else {
$resolverName = $attribute->resolver;
}
@@ -94,7 +94,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
}
if (1 < $count && !$metadata->isVariadic()) {
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at most one value for non-variadic arguments.', get_debug_type($resolver)));
throw new \InvalidArgumentException(\sprintf('"%s::resolve()" must yield at most one value for non-variadic arguments.', get_debug_type($resolver)));
}
if ($count) {
@@ -103,11 +103,11 @@ final class ArgumentResolver implements ArgumentResolverInterface
}
if (!$resolver instanceof ValueResolverInterface) {
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at least one value.', get_debug_type($resolver)));
throw new \InvalidArgumentException(\sprintf('"%s::resolve()" must yield at least one value.', get_debug_type($resolver)));
}
}
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()));
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()));
}
return $arguments;

View File

@@ -78,7 +78,7 @@ class BackedEnumValueResolver implements ArgumentValueResolverInterface, ValueRe
}
if (!\is_int($value) && !\is_string($value)) {
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)));
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)));
}
/** @var class-string<\BackedEnum> $enumType */
@@ -87,7 +87,7 @@ class BackedEnumValueResolver implements ArgumentValueResolverInterface, ValueRe
try {
return [$enumType::from($value)];
} catch (\ValueError|\TypeError $e) {
throw new NotFoundHttpException(sprintf('Could not resolve the "%s $%s" controller argument: ', $argument->getType(), $argument->getName()).$e->getMessage(), $e);
throw new NotFoundHttpException(\sprintf('Could not resolve the "%s $%s" controller argument: ', $argument->getType(), $argument->getName()).$e->getMessage(), $e);
}
}
}

View File

@@ -90,7 +90,7 @@ final class DateTimeValueResolver implements ArgumentValueResolverInterface, Val
}
if (!$date) {
throw new NotFoundHttpException(sprintf('Invalid date given for parameter "%s".', $argument->getName()));
throw new NotFoundHttpException(\sprintf('Invalid date given for parameter "%s".', $argument->getName()));
}
return [$date];

View File

@@ -82,8 +82,8 @@ final class NotTaggedControllerValueResolver implements ArgumentValueResolverInt
return [];
}
$what = sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
$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);
$what = \sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
$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);
throw new RuntimeException($message);
}

View File

@@ -38,7 +38,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
return [];
}
throw new NotFoundHttpException(sprintf('Missing query parameter "%s".', $name));
throw new NotFoundHttpException(\sprintf('Missing query parameter "%s".', $name));
}
$value = $request->query->all()[$name];
@@ -52,7 +52,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
$filtered = array_values(array_filter((array) $value, \is_array(...)));
if ($filtered !== $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
throw new NotFoundHttpException(sprintf('Invalid query parameter "%s".', $name));
throw new NotFoundHttpException(\sprintf('Invalid query parameter "%s".', $name));
}
return $filtered;
@@ -80,8 +80,8 @@ final class QueryParameterValueResolver implements ValueResolverInterface
default => match ($enumType = is_subclass_of($type, \BackedEnum::class) ? (new \ReflectionEnum($type))->getBackingType()->getName() : null) {
'int' => \FILTER_VALIDATE_INT,
'string' => \FILTER_DEFAULT,
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')),
}
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')),
},
};
$value = filter_var($value, $attribute->filter ?? $filter, $options);
@@ -103,7 +103,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
}
if (null === $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
throw new NotFoundHttpException(sprintf('Invalid query parameter "%s".', $name));
throw new NotFoundHttpException(\sprintf('Invalid query parameter "%s".', $name));
}
if (!\is_array($value)) {
@@ -117,7 +117,7 @@ final class QueryParameterValueResolver implements ValueResolverInterface
}
if ($filtered !== $value && !($attribute->flags & \FILTER_NULL_ON_FAILURE)) {
throw new NotFoundHttpException(sprintf('Invalid query parameter "%s".', $name));
throw new NotFoundHttpException(\sprintf('Invalid query parameter "%s".', $name));
}
return $argument->isVariadic() ? $filtered : [$filtered];

View File

@@ -71,7 +71,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
}
if ($argument->isVariadic()) {
throw new \LogicException(sprintf('Mapping variadic argument "$%s" is not supported.', $argument->getName()));
throw new \LogicException(\sprintf('Mapping variadic argument "$%s" is not supported.', $argument->getName()));
}
$attribute->metadata = $argument;
@@ -96,7 +96,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
$request = $event->getRequest();
if (!$type = $argument->metadata->getType()) {
throw new \LogicException(sprintf('Could not resolve the "$%s" controller argument: argument should be typed.', $argument->metadata->getName()));
throw new \LogicException(\sprintf('Could not resolve the "$%s" controller argument: argument should be typed.', $argument->metadata->getName()));
}
if ($this->validator) {
@@ -140,7 +140,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
$payload = match (true) {
$argument->metadata->hasDefaultValue() => $argument->metadata->getDefaultValue(),
$argument->metadata->isNullable() => null,
default => throw new HttpException($validationFailedCode)
default => throw new HttpException($validationFailedCode),
};
}
@@ -173,7 +173,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
}
if ($attribute->acceptFormat && !\in_array($format, (array) $attribute->acceptFormat, true)) {
throw new HttpException(Response::HTTP_UNSUPPORTED_MEDIA_TYPE, sprintf('Unsupported format, expects "%s", but "%s" given.', implode('", "', (array) $attribute->acceptFormat), $format));
throw new HttpException(Response::HTTP_UNSUPPORTED_MEDIA_TYPE, \sprintf('Unsupported format, expects "%s", but "%s" given.', implode('", "', (array) $attribute->acceptFormat), $format));
}
if ($data = $request->request->all()) {
@@ -191,9 +191,9 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
try {
return $this->serializer->deserialize($data, $type, $format, self::CONTEXT_DESERIALIZE + $attribute->serializationContext);
} catch (UnsupportedFormatException $e) {
throw new HttpException(Response::HTTP_UNSUPPORTED_MEDIA_TYPE, sprintf('Unsupported format: "%s".', $format), $e);
throw new HttpException(Response::HTTP_UNSUPPORTED_MEDIA_TYPE, \sprintf('Unsupported format: "%s".', $format), $e);
} catch (NotEncodableValueException $e) {
throw new HttpException(Response::HTTP_BAD_REQUEST, sprintf('Request payload contains invalid "%s" data.', $format), $e);
throw new HttpException(Response::HTTP_BAD_REQUEST, \sprintf('Request payload contains invalid "%s" data.', $format), $e);
}
}
}

View File

@@ -83,11 +83,11 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface, Valu
try {
return [$this->container->get($controller)->get($argument->getName())];
} catch (RuntimeException $e) {
$what = sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
$what = \sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
$message = preg_replace('/service "\.service_locator\.[^"]++"/', $what, $e->getMessage());
if ($e->getMessage() === $message) {
$message = sprintf('Cannot resolve %s: %s', $what, $message);
$message = \sprintf('Cannot resolve %s: %s', $what, $message);
}
$r = new \ReflectionProperty($e, 'message');

View File

@@ -46,7 +46,7 @@ final class UidValueResolver implements ArgumentValueResolverInterface, ValueRes
try {
return [$uidClass::fromString($value)];
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException(sprintf('The uid for the "%s" parameter is invalid.', $argument->getName()), $e);
throw new NotFoundHttpException(\sprintf('The uid for the "%s" parameter is invalid.', $argument->getName()), $e);
}
}
}

View File

@@ -42,7 +42,7 @@ final class VariadicValueResolver implements ArgumentValueResolverInterface, Val
$values = $request->attributes->get($argument->getName());
if (!\is_array($values)) {
throw new \InvalidArgumentException(sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), get_debug_type($values)));
throw new \InvalidArgumentException(\sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), get_debug_type($values)));
}
return $values;

View File

@@ -48,16 +48,16 @@ class ContainerControllerResolver extends ControllerResolver
$this->throwExceptionIfControllerWasRemoved($class, $e);
if ($e instanceof \ArgumentCountError) {
throw new \InvalidArgumentException(sprintf('Controller "%s" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service?', $class), 0, $e);
throw new \InvalidArgumentException(\sprintf('Controller "%s" has required constructor arguments and does not exist in the container. Did you forget to define the controller as a service?', $class), 0, $e);
}
throw new \InvalidArgumentException(sprintf('Controller "%s" does neither exist as service nor as class.', $class), 0, $e);
throw new \InvalidArgumentException(\sprintf('Controller "%s" does neither exist as service nor as class.', $class), 0, $e);
}
private function throwExceptionIfControllerWasRemoved(string $controller, \Throwable $previous): void
{
if ($this->container instanceof Container && isset($this->container->getRemovedIds()[$controller])) {
throw new \InvalidArgumentException(sprintf('Controller "%s" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?', $controller), 0, $previous);
throw new \InvalidArgumentException(\sprintf('Controller "%s" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?', $controller), 0, $previous);
}
}
}

View File

@@ -74,7 +74,7 @@ class ControllerResolver implements ControllerResolverInterface
}
if (!\is_callable($controller)) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
}
return $this->checkController($request, $controller);
@@ -82,7 +82,7 @@ class ControllerResolver implements ControllerResolverInterface
if (\is_object($controller)) {
if (!\is_callable($controller)) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($controller));
}
return $this->checkController($request, $controller);
@@ -95,11 +95,11 @@ class ControllerResolver implements ControllerResolverInterface
try {
$callable = $this->createController($controller);
} catch (\InvalidArgumentException $e) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$e->getMessage(), 0, $e);
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$e->getMessage(), 0, $e);
}
if (!\is_callable($callable)) {
throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($callable));
throw new \InvalidArgumentException(\sprintf('The controller for URI "%s" is not callable: ', $request->getPathInfo()).$this->getControllerError($callable));
}
return $this->checkController($request, $callable);
@@ -159,19 +159,19 @@ class ControllerResolver implements ControllerResolverInterface
if (str_contains($callable, '::')) {
$callable = explode('::', $callable, 2);
} else {
return sprintf('Function "%s" does not exist.', $callable);
return \sprintf('Function "%s" does not exist.', $callable);
}
}
if (\is_object($callable)) {
$availableMethods = $this->getClassMethodsWithoutMagicMethods($callable);
$alternativeMsg = $availableMethods ? sprintf(' or use one of the available methods: "%s"', implode('", "', $availableMethods)) : '';
$alternativeMsg = $availableMethods ? \sprintf(' or use one of the available methods: "%s"', implode('", "', $availableMethods)) : '';
return sprintf('Controller class "%s" cannot be called without a method name. You need to implement "__invoke"%s.', get_debug_type($callable), $alternativeMsg);
return \sprintf('Controller class "%s" cannot be called without a method name. You need to implement "__invoke"%s.', get_debug_type($callable), $alternativeMsg);
}
if (!\is_array($callable)) {
return sprintf('Invalid type for controller given, expected string, array or object, got "%s".', get_debug_type($callable));
return \sprintf('Invalid type for controller given, expected string, array or object, got "%s".', get_debug_type($callable));
}
if (!isset($callable[0]) || !isset($callable[1]) || 2 !== \count($callable)) {
@@ -181,13 +181,13 @@ class ControllerResolver implements ControllerResolverInterface
[$controller, $method] = $callable;
if (\is_string($controller) && !class_exists($controller)) {
return sprintf('Class "%s" does not exist.', $controller);
return \sprintf('Class "%s" does not exist.', $controller);
}
$className = \is_object($controller) ? get_debug_type($controller) : $controller;
if (method_exists($controller, $method)) {
return sprintf('Method "%s" on class "%s" should be public and non-abstract.', $method, $className);
return \sprintf('Method "%s" on class "%s" should be public and non-abstract.', $method, $className);
}
$collection = $this->getClassMethodsWithoutMagicMethods($controller);
@@ -204,12 +204,12 @@ class ControllerResolver implements ControllerResolverInterface
asort($alternatives);
$message = sprintf('Expected method "%s" on class "%s"', $method, $className);
$message = \sprintf('Expected method "%s" on class "%s"', $method, $className);
if (\count($alternatives) > 0) {
$message .= sprintf(', did you mean "%s"?', implode('", "', $alternatives));
$message .= \sprintf(', did you mean "%s"?', implode('", "', $alternatives));
} else {
$message .= sprintf('. Available methods: "%s".', implode('", "', $collection));
$message .= \sprintf('. Available methods: "%s".', implode('", "', $collection));
}
return $message;
@@ -274,6 +274,6 @@ class ControllerResolver implements ControllerResolverInterface
return $controller;
}
throw new BadRequestException(sprintf('Callable "%s()" is not allowed as a controller. Did you miss tagging it with "#[AsController]" or registering its type with "%s::allowControllers()"?', $name, self::class));
throw new BadRequestException(\sprintf('Callable "%s()" is not allowed as a controller. Did you miss tagging it with "#[AsController]" or registering its type with "%s::allowControllers()"?', $name, self::class));
}
}

View File

@@ -94,7 +94,7 @@ class ArgumentMetadata
public function getDefaultValue(): mixed
{
if (!$this->hasDefaultValue) {
throw new \LogicException(sprintf('Argument $%s does not have a default value. Use "%s::hasDefaultValue()" to avoid this exception.', $this->name, __CLASS__));
throw new \LogicException(\sprintf('Argument $%s does not have a default value. Use "%s::hasDefaultValue()" to avoid this exception.', $this->name, __CLASS__));
}
return $this->defaultValue;

View File

@@ -47,7 +47,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
$this->data = [
'token' => $response->headers->get('X-Debug-Token'),
'symfony_version' => Kernel::VERSION,
'symfony_minor_version' => sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION),
'symfony_minor_version' => \sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION),
'symfony_lts' => 4 === Kernel::MINOR_VERSION,
'symfony_state' => $this->determineSymfonyState(),
'symfony_eom' => $eom->format('F Y'),

View File

@@ -196,7 +196,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$dumper = new HtmlDumper($data, $this->charset);
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
throw new \InvalidArgumentException(sprintf('Invalid dump format: "%s".', $format));
throw new \InvalidArgumentException(\sprintf('Invalid dump format: "%s".', $format));
}
$dumps = [];
@@ -263,9 +263,9 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$f = strip_tags($this->style('', $file));
$name = strip_tags($this->style('', $name));
if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) {
$name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
$name = \sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
} else {
$name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);
$name = \sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);
}
} else {
$name = $this->style('meta', $name);

View File

@@ -452,7 +452,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
array_splice($trace, 0, $traceEndIndex);
// Merge identical backtraces generated by internal call reports
$name = sprintf('%s:%s', $trace[1]['class'] ?? $trace[0]['file'], $trace[0]['line']);
$name = \sprintf('%s:%s', $trace[1]['class'] ?? $trace[0]['file'], $trace[0]['line']);
if (!\array_key_exists($name, $this->sessionUsages)) {
$this->sessionUsages[$name] = [
'name' => $name,

View File

@@ -40,7 +40,7 @@ class RouterDataCollector extends DataCollector
$this->data['redirect'] = true;
$this->data['url'] = $response->getTargetUrl();
if ($this->controllers->contains($request)) {
if ($this->controllers->offsetExists($request)) {
$this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
}
}

View File

@@ -41,10 +41,10 @@ class FragmentRendererPass implements CompilerPassInterface
$class = $container->getParameterBag()->resolveValue($def->getClass());
if (!$r = $container->getReflectionClass($class)) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
if (!$r->isSubclassOf(FragmentRendererInterface::class)) {
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, FragmentRendererInterface::class));
throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, FragmentRendererInterface::class));
}
foreach ($tags as $tag) {

View File

@@ -73,7 +73,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
$class = $parameterBag->resolveValue($class);
if (!$r = $container->getReflectionClass($class)) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
$controllerClasses[] = $class;
@@ -98,11 +98,11 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
foreach (['action', 'argument', 'id'] as $k) {
if (!isset($attributes[$k][0])) {
throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "controller.service_arguments" %s for service "%s".', $k, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id));
throw new InvalidArgumentException(\sprintf('Missing "%s" attribute on tag "controller.service_arguments" %s for service "%s".', $k, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id));
}
}
if (!isset($methods[$action = strtolower($attributes['action'])])) {
throw new InvalidArgumentException(sprintf('Invalid "action" attribute on tag "controller.service_arguments" for service "%s": no public "%s()" method found on class "%s".', $id, $attributes['action'], $class));
throw new InvalidArgumentException(\sprintf('Invalid "action" attribute on tag "controller.service_arguments" for service "%s": no public "%s()" method found on class "%s".', $id, $attributes['action'], $class));
}
[$r, $parameters] = $methods[$action];
$found = false;
@@ -118,7 +118,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
if (!$found) {
throw new InvalidArgumentException(sprintf('Invalid "controller.service_arguments" tag for service "%s": method "%s()" has no "%s" argument on class "%s".', $id, $r->name, $attributes['argument'], $class));
throw new InvalidArgumentException(\sprintf('Invalid "controller.service_arguments" tag for service "%s": method "%s()" has no "%s" argument on class "%s".', $id, $r->name, $attributes['argument'], $class));
}
}
@@ -140,7 +140,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
if ('?' !== $target[0]) {
$invalidBehavior = ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE;
} elseif ('' === $target = (string) substr($target, 1)) {
throw new InvalidArgumentException(sprintf('A "controller.service_arguments" tag must have non-empty "id" attributes for service "%s".', $id));
throw new InvalidArgumentException(\sprintf('A "controller.service_arguments" tag must have non-empty "id" attributes for service "%s".', $id));
} elseif ($p->allowsNull() && !$p->isOptional()) {
$invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
}
@@ -191,7 +191,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
if ($type && !$p->isOptional() && !$p->allowsNull() && !class_exists($type) && !interface_exists($type, false)) {
$message = sprintf('Cannot determine controller argument for "%s::%s()": the $%s argument is type-hinted with the non-existent class or interface: "%s".', $class, $r->name, $p->name, $type);
$message = \sprintf('Cannot determine controller argument for "%s::%s()": the $%s argument is type-hinted with the non-existent class or interface: "%s".', $class, $r->name, $p->name, $type);
// see if the type-hint lives in the same namespace as the controller
if (0 === strncmp($type, $class, strrpos($class, '\\'))) {

View File

@@ -34,7 +34,7 @@ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface
if (!$argumentLocator->getArgument(0)) {
// remove empty argument locators
$reason = sprintf('Removing service-argument resolver for controller "%s": no corresponding services exist for the referenced types.', $controller);
$reason = \sprintf('Removing service-argument resolver for controller "%s": no corresponding services exist for the referenced types.', $controller);
} else {
// any methods listed for call-at-instantiation cannot be actions
$reason = false;
@@ -47,7 +47,7 @@ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface
$controllerDef = $container->getDefinition($id);
foreach ($controllerDef->getMethodCalls() as [$method]) {
if (0 === strcasecmp($action, $method)) {
$reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id);
$reason = \sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id);
break;
}
}

View File

@@ -39,7 +39,7 @@ class ResettableServicePass implements CompilerPassInterface
foreach ($tags as $attributes) {
if (!isset($attributes['method'])) {
throw new RuntimeException(sprintf('Tag "kernel.reset" requires the "method" attribute to be set on service "%s".', $id));
throw new RuntimeException(\sprintf('Tag "kernel.reset" requires the "method" attribute to be set on service "%s".', $id));
}
if (!isset($methods[$id])) {

View File

@@ -90,7 +90,7 @@ class ErrorListener implements EventSubscriberInterface
$e = FlattenException::createFromThrowable($throwable);
$this->logException($throwable, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass(), $e->getMessage(), basename($e->getFile()), $e->getLine()), $logLevel);
$this->logException($throwable, \sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass(), $e->getMessage(), basename($e->getFile()), $e->getLine()), $logLevel);
}
/**
@@ -118,7 +118,7 @@ class ErrorListener implements EventSubscriberInterface
} catch (\Exception $e) {
$f = FlattenException::createFromThrowable($e);
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine()));
$this->logException($e, \sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine()));
$prev = $e;
do {

View File

@@ -118,15 +118,15 @@ class RouterListener implements EventSubscriberInterface
unset($parameters['_route'], $parameters['_controller']);
$request->attributes->set('_route_params', $parameters);
} catch (ResourceNotFoundException $e) {
$message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getUriForPath($request->getPathInfo()));
$message = \sprintf('No route found for "%s %s"', $request->getMethod(), $request->getUriForPath($request->getPathInfo()));
if ($referer = $request->headers->get('referer')) {
$message .= sprintf(' (from "%s")', $referer);
$message .= \sprintf(' (from "%s")', $referer);
}
throw new NotFoundHttpException($message, $e);
} catch (MethodNotAllowedException $e) {
$message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getUriForPath($request->getPathInfo()), implode(', ', $e->getAllowedMethods()));
$message = \sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getUriForPath($request->getPathInfo()), implode(', ', $e->getAllowedMethods()));
throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e);
}

View File

@@ -18,7 +18,7 @@ class ResolverNotFoundException extends \RuntimeException
*/
public function __construct(string $name, array $alternatives = [])
{
$msg = sprintf('You have requested a non-existent resolver "%s".', $name);
$msg = \sprintf('You have requested a non-existent resolver "%s".', $name);
if ($alternatives) {
if (1 === \count($alternatives)) {
$msg .= ' Did you mean this: "';

View File

@@ -73,7 +73,7 @@ class FragmentHandler
}
if (!isset($this->renderers[$renderer])) {
throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer));
throw new \InvalidArgumentException(\sprintf('The "%s" renderer does not exist.', $renderer));
}
if (!$request = $this->requestStack->getCurrentRequest()) {
@@ -97,7 +97,7 @@ class FragmentHandler
{
if (!$response->isSuccessful()) {
$responseStatusCode = $response->getStatusCode();
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
throw new \RuntimeException(\sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
}
if (!$response instanceof StreamedResponse) {

View File

@@ -83,7 +83,7 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
if (\is_array($value)) {
$this->checkNonScalar($value);
} elseif (!\is_scalar($value) && null !== $value) {
throw new \LogicException(sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key));
throw new \LogicException(\sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key));
}
}
}

View File

@@ -79,7 +79,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
if (\count($attributes) > 0) {
$flags = \ENT_QUOTES | \ENT_SUBSTITUTE;
foreach ($attributes as $attribute => $value) {
$renderedAttributes .= sprintf(
$renderedAttributes .= \sprintf(
' %s="%s"',
htmlspecialchars($attribute, $flags, $this->charset, false),
htmlspecialchars($value, $flags, $this->charset, false)
@@ -87,7 +87,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
}
}
return new Response(sprintf('<hx:include src="%s"%s>%s</hx:include>', $uri, $renderedAttributes, $content));
return new Response(\sprintf('<hx:include src="%s"%s>%s</hx:include>', $uri, $renderedAttributes, $content));
}
public function getName(): string

View File

@@ -56,7 +56,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
return false;
}
return str_contains($value, sprintf('%s/1.0', strtoupper($this->getName())));
return str_contains($value, \sprintf('%s/1.0', strtoupper($this->getName())));
}
/**
@@ -65,7 +65,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
public function addSurrogateCapability(Request $request)
{
$current = $request->headers->get('Surrogate-Capability');
$new = sprintf('symfony="%s/1.0"', strtoupper($this->getName()));
$new = \sprintf('symfony="%s/1.0"', strtoupper($this->getName()));
$request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new);
}
@@ -76,7 +76,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
return false;
}
$pattern = sprintf('#content="[^"]*%s/1.0[^"]*"#', strtoupper($this->getName()));
$pattern = \sprintf('#content="[^"]*%s/1.0[^"]*"#', strtoupper($this->getName()));
return (bool) preg_match($pattern, $control);
}
@@ -89,7 +89,7 @@ abstract class AbstractSurrogate implements SurrogateInterface
$response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
if (!$response->isSuccessful() && Response::HTTP_NOT_MODIFIED !== $response->getStatusCode()) {
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $subRequest->getUri(), $response->getStatusCode()));
throw new \RuntimeException(\sprintf('Error when rendering "%s" (Status code is %d).', $subRequest->getUri(), $response->getStatusCode()));
}
return $response->getContent();
@@ -120,12 +120,12 @@ abstract class AbstractSurrogate implements SurrogateInterface
$value = $response->headers->get('Surrogate-Control');
$upperName = strtoupper($this->getName());
if (sprintf('content="%s/1.0"', $upperName) == $value) {
if (\sprintf('content="%s/1.0"', $upperName) == $value) {
$response->headers->remove('Surrogate-Control');
} elseif (preg_match(sprintf('#,\s*content="%s/1.0"#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(sprintf('#,\s*content="%s/1.0"#', $upperName), '', $value));
} elseif (preg_match(sprintf('#content="%s/1.0",\s*#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(sprintf('#content="%s/1.0",\s*#', $upperName), '', $value));
} elseif (preg_match(\sprintf('#,\s*content="%s/1.0"#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(\sprintf('#,\s*content="%s/1.0"#', $upperName), '', $value));
} elseif (preg_match(\sprintf('#content="%s/1.0",\s*#', $upperName), $value)) {
$response->headers->set('Surrogate-Control', preg_replace(\sprintf('#content="%s/1.0",\s*#', $upperName), '', $value));
}
}

View File

@@ -44,14 +44,14 @@ class Esi extends AbstractSurrogate
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
{
$html = sprintf('<esi:include src="%s"%s%s />',
$html = \sprintf('<esi:include src="%s"%s%s />',
$uri,
$ignoreErrors ? ' onerror="continue"' : '',
$alt ? sprintf(' alt="%s"', $alt) : ''
$alt ? \sprintf(' alt="%s"', $alt) : ''
);
if (!empty($comment)) {
return sprintf("<esi:comment text=\"%s\" />\n%s", $comment, $html);
return \sprintf("<esi:comment text=\"%s\" />\n%s", $comment, $html);
}
return $html;

View File

@@ -158,7 +158,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
{
$log = [];
foreach ($this->traces as $request => $traces) {
$log[] = sprintf('%s: %s', $request, implode(', ', $traces));
$log[] = \sprintf('%s: %s', $request, implode(', ', $traces));
}
return implode('; ', $log);

View File

@@ -37,7 +37,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
private int $embeddedResponses = 0;
private bool $isNotCacheableResponseEmbedded = false;
private int $age = 0;
private \DateTimeInterface|null|false $lastModified = null;
private \DateTimeInterface|false|null $lastModified = null;
private array $flagDirectives = [
'no-cache' => null,
'no-store' => null,
@@ -228,7 +228,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
}
if (false !== $this->ageDirectives[$directive]) {
$value = min($value ?? PHP_INT_MAX, $expires ?? PHP_INT_MAX);
$value = min($value ?? \PHP_INT_MAX, $expires ?? \PHP_INT_MAX);
$value -= $age;
$this->ageDirectives[$directive] = null !== $this->ageDirectives[$directive] ? min($this->ageDirectives[$directive], $value) : $value;
}

View File

@@ -38,7 +38,7 @@ class Ssi extends AbstractSurrogate
public function renderIncludeTag(string $uri, ?string $alt = null, bool $ignoreErrors = true, string $comment = ''): string
{
return sprintf('<!--#include virtual="%s" -->', $uri);
return \sprintf('<!--#include virtual="%s" -->', $uri);
}
public function process(Request $request, Response $response): Response

View File

@@ -45,7 +45,7 @@ class Store implements StoreInterface
{
$this->root = $root;
if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) {
throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root));
throw new \RuntimeException(\sprintf('Unable to create the store directory (%s).', $this->root));
}
$this->keyCache = new \SplObjectStorage();
$this->options = array_merge([

View File

@@ -51,16 +51,16 @@ class SubRequestHandler
$trustedValues = [];
foreach (array_reverse($request->getClientIps()) as $ip) {
$trustedIps[] = $ip;
$trustedValues[] = sprintf('for="%s"', $ip);
$trustedValues[] = \sprintf('for="%s"', $ip);
}
if ($ip !== $remoteAddr) {
$trustedIps[] = $remoteAddr;
$trustedValues[] = sprintf('for="%s"', $remoteAddr);
$trustedValues[] = \sprintf('for="%s"', $remoteAddr);
}
// set trusted values, reusing as much as possible the global trusted settings
if (Request::HEADER_FORWARDED & $trustedHeaderSet) {
$trustedValues[0] .= sprintf(';host="%s";proto=%s', $request->getHttpHost(), $request->getScheme());
$trustedValues[0] .= \sprintf(';host="%s";proto=%s', $request->getHttpHost(), $request->getScheme());
$request->headers->set('Forwarded', $v = implode(', ', $trustedValues));
$request->server->set('HTTP_FORWARDED', $v);
}

View File

@@ -36,7 +36,7 @@ final class HttpClientKernel implements HttpKernelInterface
public function __construct(?HttpClientInterface $client = null)
{
if (null === $client && !class_exists(HttpClient::class)) {
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
throw new \LogicException(\sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
}
$this->client = $client ?? HttpClient::create();

View File

@@ -162,7 +162,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
// load controller
if (false === $controller = $this->resolver->getController($request)) {
throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo()));
throw new NotFoundHttpException(\sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo()));
}
$event = new ControllerEvent($this, $controller, $request, $type);
@@ -188,7 +188,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
if ($event->hasResponse()) {
$response = $event->getResponse();
} else {
$msg = sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.', $this->varToString($response));
$msg = \sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.', $this->varToString($response));
// the user may have forgotten to return something
if (null === $response) {
@@ -278,20 +278,20 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
private function varToString(mixed $var): string
{
if (\is_object($var)) {
return sprintf('an object of type %s', $var::class);
return \sprintf('an object of type %s', $var::class);
}
if (\is_array($var)) {
$a = [];
foreach ($var as $k => $v) {
$a[] = sprintf('%s => ...', $k);
$a[] = \sprintf('%s => ...', $k);
}
return sprintf('an array ([%s])', mb_substr(implode(', ', $a), 0, 255));
return \sprintf('an array ([%s])', mb_substr(implode(', ', $a), 0, 255));
}
if (\is_resource($var)) {
return sprintf('a resource (%s)', get_resource_type($var));
return \sprintf('a resource (%s)', get_resource_type($var));
}
if (null === $var) {
@@ -307,11 +307,11 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
}
if (\is_string($var)) {
return sprintf('a string ("%s%s")', mb_substr($var, 0, 255), mb_strlen($var) > 255 ? '...' : '');
return \sprintf('a string ("%s%s")', mb_substr($var, 0, 255), mb_strlen($var) > 255 ? '...' : '');
}
if (is_numeric($var)) {
return sprintf('a number (%s)', (string) $var);
return \sprintf('a number (%s)', (string) $var);
}
return (string) $var;

View File

@@ -76,11 +76,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
private static array $freshCache = [];
public const VERSION = '6.4.23';
public const VERSION_ID = 60423;
public const VERSION = '6.4.25';
public const VERSION_ID = 60425;
public const MAJOR_VERSION = 6;
public const MINOR_VERSION = 4;
public const RELEASE_VERSION = 23;
public const RELEASE_VERSION = 25;
public const EXTRA_VERSION = '';
public const END_OF_MAINTENANCE = '11/2026';
@@ -89,7 +89,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function __construct(string $environment, bool $debug)
{
if (!$this->environment = $environment) {
throw new \InvalidArgumentException(sprintf('Invalid environment provided to "%s": the environment cannot be empty.', get_debug_type($this)));
throw new \InvalidArgumentException(\sprintf('Invalid environment provided to "%s": the environment cannot be empty.', get_debug_type($this)));
}
$this->debug = $debug;
@@ -216,7 +216,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function getBundle(string $name): BundleInterface
{
if (!isset($this->bundles[$name])) {
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the "registerBundles()" method of your "%s.php" file?', $name, get_debug_type($this)));
throw new \InvalidArgumentException(\sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the "registerBundles()" method of your "%s.php" file?', $name, get_debug_type($this)));
}
return $this->bundles[$name];
@@ -225,11 +225,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
public function locateResource(string $name): string
{
if ('@' !== $name[0]) {
throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name));
throw new \InvalidArgumentException(\sprintf('A resource name must start with @ ("%s" given).', $name));
}
if (str_contains($name, '..')) {
throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name));
throw new \RuntimeException(\sprintf('File name "%s" contains invalid characters (..).', $name));
}
$bundleName = substr($name, 1);
@@ -243,7 +243,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
return $file;
}
throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name));
throw new \InvalidArgumentException(\sprintf('Unable to find file "%s".', $name));
}
public function getEnvironment(): string
@@ -265,7 +265,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$r = new \ReflectionObject($this);
if (!is_file($dir = $r->getFileName())) {
throw new \LogicException(sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
throw new \LogicException(\sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
}
$dir = $rootDir = \dirname($dir);
@@ -295,7 +295,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
public function setAnnotatedClassCache(array $annotatedClasses): void
{
file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)));
file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', \sprintf('<?php return %s;', var_export($annotatedClasses, true)));
}
public function getStartTime(): float
@@ -346,7 +346,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
foreach ($this->registerBundles() as $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s".', $name));
throw new \LogicException(\sprintf('Trying to register two bundles with the same name "%s".', $name));
}
$this->bundles[$name] = $bundle;
}
@@ -375,7 +375,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$class = str_replace('\\', '_', $class).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container';
if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $class)) {
throw new \InvalidArgumentException(sprintf('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names.', $this->environment));
throw new \InvalidArgumentException(\sprintf('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names.', $this->environment));
}
return $class;
@@ -604,10 +604,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
foreach (['cache' => $this->getCacheDir(), 'build' => $this->warmupDir ?: $this->getBuildDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
if (!is_dir($dir)) {
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
throw new \RuntimeException(\sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
}
} elseif (!is_writable($dir)) {
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
throw new \RuntimeException(\sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
}
}

View File

@@ -74,13 +74,13 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
}
if (!isset(self::LEVELS[$minLevel])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $minLevel));
throw new InvalidArgumentException(\sprintf('The log level "%s" does not exist.', $minLevel));
}
$this->minLevelIndex = self::LEVELS[$minLevel];
$this->formatter = null !== $formatter ? $formatter(...) : $this->format(...);
if ($output && false === $this->handle = \is_string($output) ? @fopen($output, 'a') : $output) {
throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output));
throw new InvalidArgumentException(\sprintf('Unable to open "%s".', $output));
}
$this->debug = $debug;
}
@@ -93,7 +93,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
public function log($level, $message, array $context = []): void
{
if (!isset(self::LEVELS[$level])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
throw new InvalidArgumentException(\sprintf('The log level "%s" does not exist.', $level));
}
if (self::LEVELS[$level] < $this->minLevelIndex) {
@@ -155,7 +155,7 @@ class Logger extends AbstractLogger implements DebugLoggerInterface
$message = strtr($message, $replacements);
}
$log = sprintf('[%s] %s', $level, $message);
$log = \sprintf('[%s] %s', $level, $message);
if ($prefixDate) {
$log = date(\DateTimeInterface::RFC3339).' '.$log;
}

View File

@@ -33,12 +33,12 @@ class FileProfilerStorage implements ProfilerStorageInterface
public function __construct(string $dsn)
{
if (!str_starts_with($dsn, 'file:')) {
throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn));
throw new \RuntimeException(\sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn));
}
$this->folder = substr($dsn, 5);
if (!is_dir($this->folder) && false === @mkdir($this->folder, 0777, true) && !is_dir($this->folder)) {
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $this->folder));
throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $this->folder));
}
}
@@ -144,7 +144,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
// Create directory
$dir = \dirname($file);
if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir));
throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $dir));
}
}

View File

@@ -232,7 +232,7 @@ class Profile
public function getCollector(string $name): DataCollectorInterface
{
if (!isset($this->collectors[$name])) {
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
}
return $this->collectors[$name];

View File

@@ -239,7 +239,7 @@ class Profiler implements ResetInterface
public function get(string $name): DataCollectorInterface
{
if (!isset($this->collectors[$name])) {
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
}
return $this->collectors[$name];