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

@@ -54,7 +54,7 @@ class AutowirePass extends AbstractRecursivePass
public function __construct(bool $throwOnAutowireException = true)
{
$this->throwOnAutowiringException = $throwOnAutowireException;
$this->defaultArgument = new class() {
$this->defaultArgument = new class {
public $value;
public $names;
public $bag;
@@ -141,7 +141,7 @@ class AutowirePass extends AbstractRecursivePass
$message = $this->createTypeNotFoundMessageCallback($value, 'it');
// since the error message varies by referenced id and $this->currentId, so should the id of the dummy errored definition
$this->container->register($id = sprintf('.errored.%s.%s', $this->currentId, (string) $value), $value->getType())
$this->container->register($id = \sprintf('.errored.%s.%s', $this->currentId, (string) $value), $value->getType())
->addError($message);
return new TypedReference($id, $value->getType(), $value->getInvalidBehavior(), $value->getName());
@@ -153,7 +153,7 @@ class AutowirePass extends AbstractRecursivePass
return $value;
}
if (!$reflectionClass = $this->container->getReflectionClass($value->getClass(), false)) {
$this->container->log($this, sprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.', $this->currentId, $value->getClass()));
$this->container->log($this, \sprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.', $this->currentId, $value->getClass()));
return $value;
}
@@ -290,7 +290,7 @@ class AutowirePass extends AbstractRecursivePass
$getValue = function () use ($type, $parameter, $class, $method, $name, $target) {
if (!$value = $this->getAutowiredReference($ref = new TypedReference($type, $type, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $name, $target), false)) {
$failureMessage = $this->createTypeNotFoundMessageCallback($ref, sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method));
$failureMessage = $this->createTypeNotFoundMessageCallback($ref, \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method));
if ($parameter->isDefaultValueAvailable()) {
$value = $this->defaultArgument->withValue($parameter);
@@ -329,7 +329,7 @@ class AutowirePass extends AbstractRecursivePass
if (!\is_array($lazy)) {
if (str_contains($type, '|')) {
throw new AutowiringFailedException($this->currentId, sprintf('Cannot use #[Autowire] with option "lazy: true" on union types for service "%s"; set the option to the interface(s) that should be proxied instead.', $this->currentId));
throw new AutowiringFailedException($this->currentId, \sprintf('Cannot use #[Autowire] with option "lazy: true" on union types for service "%s"; set the option to the interface(s) that should be proxied instead.', $this->currentId));
}
$lazy = str_contains($type, '&') ? explode('&', $type) : [];
}
@@ -382,9 +382,9 @@ class AutowirePass extends AbstractRecursivePass
break;
}
$type = ProxyHelper::exportType($parameter);
$type = $type ? sprintf('is type-hinted "%s"', preg_replace('/(^|[(|&])\\\\|^\?\\\\?/', '\1', $type)) : 'has no type-hint';
$type = $type ? \sprintf('is type-hinted "%s"', preg_replace('/(^|[(|&])\\\\|^\?\\\\?/', '\1', $type)) : 'has no type-hint';
throw new AutowiringFailedException($this->currentId, sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method, $type));
throw new AutowiringFailedException($this->currentId, \sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method, $type));
}
// specifically pass the default value
@@ -593,7 +593,7 @@ class AutowirePass extends AbstractRecursivePass
$namespace = substr($namespace, 0, $i);
if ($this->container->hasDefinition($namespace) && $tag = $this->container->getDefinition($namespace)->getTag('container.excluded')) {
return sprintf('Cannot autowire service "%s": %s needs an instance of "%s" but this type has been excluded %s.', $currentId, $label, $type, $tag[0]['source'] ?? 'from autowiring');
return \sprintf('Cannot autowire service "%s": %s needs an instance of "%s" but this type has been excluded %s.', $currentId, $label, $type, $tag[0]['source'] ?? 'from autowiring');
}
} while (false !== $i = strrpos($namespace, '\\'));
@@ -609,19 +609,19 @@ class AutowirePass extends AbstractRecursivePass
$parentMsg = "couldn't be loaded. Either it was not found or it is missing a parent class or a trait";
}
} catch (\ReflectionException $e) {
$parentMsg = sprintf('is missing a parent class (%s)', $e->getMessage());
$parentMsg = \sprintf('is missing a parent class (%s)', $e->getMessage());
}
$message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ?: 'was not found');
$message = \sprintf('has type "%s" but this class %s.', $type, $parentMsg ?: 'was not found');
} else {
$alternatives = $this->createTypeAlternatives($this->container, $reference);
if (null !== $target = (array_filter($reference->getAttributes(), static fn ($a) => $a instanceof Target)[0] ?? null)) {
$target = null !== $target->name ? "('{$target->name}')" : '';
$message = sprintf('has "#[Target%s]" but no such target exists.%s', $target, $alternatives);
$message = \sprintf('has "#[Target%s]" but no such target exists.%s', $target, $alternatives);
} else {
$message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists';
$message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives);
$message = \sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives);
}
if ($r->isInterface() && !$alternatives) {
@@ -629,7 +629,7 @@ class AutowirePass extends AbstractRecursivePass
}
}
$message = sprintf('Cannot autowire service "%s": %s %s', $currentId, $label, $message);
$message = \sprintf('Cannot autowire service "%s": %s %s', $currentId, $label, $message);
if (null !== $this->lastFailure) {
$message = $this->lastFailure."\n".$message;
@@ -654,20 +654,20 @@ class AutowirePass extends AbstractRecursivePass
unset($autowiringAliases['']);
if ($autowiringAliases) {
return sprintf(' Did you mean to target%s "%s" instead?', 1 < \count($autowiringAliases) ? ' one of' : '', implode('", "', $autowiringAliases));
return \sprintf(' Did you mean to target%s "%s" instead?', 1 < \count($autowiringAliases) ? ' one of' : '', implode('", "', $autowiringAliases));
}
if (!$container->has($type) && false !== $key = array_search(strtolower($type), array_map('strtolower', $servicesAndAliases))) {
return sprintf(' Did you mean "%s"?', $servicesAndAliases[$key]);
return \sprintf(' Did you mean "%s"?', $servicesAndAliases[$key]);
} elseif (isset($this->ambiguousServiceTypes[$type])) {
$message = sprintf('one of these existing services: "%s"', implode('", "', $this->ambiguousServiceTypes[$type]));
$message = \sprintf('one of these existing services: "%s"', implode('", "', $this->ambiguousServiceTypes[$type]));
} elseif (isset($this->types[$type])) {
$message = sprintf('the existing "%s" service', $this->types[$type]);
$message = \sprintf('the existing "%s" service', $this->types[$type]);
} else {
return '';
}
return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message);
return \sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message);
}
private function getAliasesSuggestionForType(ContainerBuilder $container, string $type): ?string
@@ -682,15 +682,15 @@ class AutowirePass extends AbstractRecursivePass
if (1 < $len = \count($aliases)) {
$message = 'Try changing the type-hint to one of its parents: ';
for ($i = 0, --$len; $i < $len; ++$i) {
$message .= sprintf('%s "%s", ', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]);
$message .= \sprintf('%s "%s", ', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]);
}
$message .= sprintf('or %s "%s".', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]);
$message .= \sprintf('or %s "%s".', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]);
return $message;
}
if ($aliases) {
return sprintf('Try changing the type-hint to "%s" instead.', $aliases[0]);
return \sprintf('Try changing the type-hint to "%s" instead.', $aliases[0]);
}
return null;