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

@@ -226,7 +226,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return $this->extensionsByNs[$name];
}
throw new LogicException(sprintf('Container extension "%s" is not registered.', $name));
throw new LogicException(\sprintf('Container extension "%s" is not registered.', $name));
}
/**
@@ -488,7 +488,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
{
if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) {
// setting a synthetic service on a compiled container is alright
throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id));
throw new BadMethodCallException(\sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id));
}
unset($this->definitions[$id], $this->aliasDefinitions[$id], $this->removedIds[$id]);
@@ -669,7 +669,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
foreach ($container->getAutoconfiguredInstanceof() as $interface => $childDefinition) {
if (isset($this->autoconfiguredInstanceof[$interface])) {
throw new InvalidArgumentException(sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.', $interface));
throw new InvalidArgumentException(\sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.', $interface));
}
$this->autoconfiguredInstanceof[$interface] = $childDefinition;
@@ -677,7 +677,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
foreach ($container->getAutoconfiguredAttributes() as $attribute => $configurator) {
if (isset($this->autoconfiguredAttributes[$attribute])) {
throw new InvalidArgumentException(sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same attribute.', $attribute));
throw new InvalidArgumentException(\sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same attribute.', $attribute));
}
$this->autoconfiguredAttributes[$attribute] = $configurator;
@@ -722,7 +722,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
public function deprecateParameter(string $name, string $package, string $version, string $message = 'The parameter "%s" is deprecated.'): void
{
if (!$this->parameterBag instanceof ParameterBag) {
throw new BadMethodCallException(sprintf('The parameter bag must be an instance of "%s" to call "%s".', ParameterBag::class, __METHOD__));
throw new BadMethodCallException(\sprintf('The parameter bag must be an instance of "%s" to call "%s".', ParameterBag::class, __METHOD__));
}
$this->parameterBag->deprecate($name, $package, $version, $message);
@@ -777,7 +777,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if ($bag instanceof EnvPlaceholderParameterBag) {
if ($resolveEnvPlaceholders) {
$this->parameterBag = new ParameterBag($this->resolveEnvPlaceholders($bag->all(), true));
$this->parameterBag = new ParameterBag($this->resolveEnvPlaceholders($this->escapeParameters($bag->all()), true));
}
$this->envPlaceholders = $bag->getEnvPlaceholders();
@@ -843,7 +843,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
public function setAlias(string $alias, string|Alias $id): Alias
{
if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) {
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias));
throw new InvalidArgumentException(\sprintf('Invalid alias id: "%s".', $alias));
}
if (\is_string($id)) {
@@ -851,7 +851,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
}
if ($alias === (string) $id) {
throw new InvalidArgumentException(sprintf('An alias cannot reference itself, got a circular reference on "%s".', $alias));
throw new InvalidArgumentException(\sprintf('An alias cannot reference itself, got a circular reference on "%s".', $alias));
}
unset($this->definitions[$alias], $this->removedIds[$alias]);
@@ -889,7 +889,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
public function getAlias(string $id): Alias
{
if (!isset($this->aliasDefinitions[$id])) {
throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id));
throw new InvalidArgumentException(\sprintf('The service alias "%s" does not exist.', $id));
}
return $this->aliasDefinitions[$id];
@@ -966,7 +966,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
}
if ('' === $id || '\\' === $id[-1] || \strlen($id) !== strcspn($id, "\0\r\n'")) {
throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id));
throw new InvalidArgumentException(\sprintf('Invalid service id: "%s".', $id));
}
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
@@ -1037,11 +1037,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
}
if ($definition instanceof ChildDefinition) {
throw new RuntimeException(sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id));
throw new RuntimeException(\sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id));
}
if ($definition->isSynthetic()) {
throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
throw new RuntimeException(\sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
}
if ($definition->isDeprecated()) {
@@ -1102,7 +1102,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if (\is_array($factory)) {
$factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]];
} elseif (!\is_string($factory)) {
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id));
throw new RuntimeException(\sprintf('Cannot create service "%s" because of invalid factory.', $id));
} elseif (str_starts_with($factory, '@=')) {
$factory = fn (ServiceLocator $arguments) => $this->getExpressionLanguage()->evaluate(substr($factory, 2), ['container' => $this, 'args' => $arguments]);
$arguments = [new ServiceLocatorArgument($arguments)];
@@ -1125,7 +1125,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) {
$r = new \ReflectionClass($factory[0]);
if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
if (0 < strpos($r->getDocComment() ?: '', "\n * @deprecated ")) {
trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name);
}
}
@@ -1142,7 +1142,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
$service = $r->getConstructor() ? $r->newInstanceArgs($arguments) : $r->newInstance();
}
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment() ?: '', "\n * @deprecated ")) {
trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name);
}
}
@@ -1185,7 +1185,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
}
if (!\is_callable($callable)) {
throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', get_debug_type($service)));
throw new InvalidArgumentException(\sprintf('The configure callable for class "%s" is not a callable.', get_debug_type($service)));
}
$callable($service);
@@ -1294,7 +1294,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
foreach ($this->getDefinitions() as $id => $definition) {
if ($definition->hasTag($name) && !$definition->hasTag('container.excluded')) {
if ($throwOnAbstract && $definition->isAbstract()) {
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must not be abstract.', $id, $name));
throw new InvalidArgumentException(\sprintf('The service "%s" tagged "%s" must not be abstract.', $id, $name));
}
$tags[$id] = $definition->getTag($name);
}
@@ -1388,10 +1388,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if (!preg_match('/^[a-zA-Z_\x7f-\xff]/', $parsedName)) {
if ($id !== $name) {
$id = sprintf(' for service "%s"', $id);
$id = \sprintf(' for service "%s"', $id);
}
throw new InvalidArgumentException(sprintf('Invalid argument name "%s"'.$id.': the first character must be a letter.', $name));
throw new InvalidArgumentException(\sprintf('Invalid argument name "%s"'.$id.': the first character must be a letter.', $name));
}
if ($parsedName !== $name) {
@@ -1463,14 +1463,14 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if (true === $format) {
$resolved = $bag->escapeValue($this->getEnv($env));
} else {
$resolved = sprintf($format, $env);
$resolved = \sprintf($format, $env);
}
if ($placeholder === $value) {
$value = $resolved;
$completed = true;
} else {
if (!\is_string($resolved) && !is_numeric($resolved)) {
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, get_debug_type($resolved), $this->resolveEnvPlaceholders($value)));
throw new RuntimeException(\sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, get_debug_type($resolved), $this->resolveEnvPlaceholders($value)));
}
$value = str_ireplace($placeholder, $resolved, $value);
}
@@ -1525,7 +1525,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
final public static function willBeAvailable(string $package, string $class, array $parentPackages): bool
{
if (!class_exists(InstalledVersions::class)) {
throw new \LogicException(sprintf('Calling "%s" when dependencies have been installed with Composer 1 is not supported. Consider upgrading to Composer 2.', __METHOD__));
throw new \LogicException(\sprintf('Calling "%s" when dependencies have been installed with Composer 1 is not supported. Consider upgrading to Composer 2.', __METHOD__));
}
if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) {
@@ -1728,4 +1728,18 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return $this->pathsInVendor[$path] = false;
}
private function escapeParameters(array $parameters): array
{
$params = [];
foreach ($parameters as $k => $v) {
$params[$k] = match (true) {
\is_array($v) => $this->escapeParameters($v),
\is_string($v) => str_replace('%', '%%', $v),
default => $v,
};
}
return $params;
}
}