Skip to content

Commit d11a6df

Browse files
committed
[Config] Improve exception messages
1 parent 9774144 commit d11a6df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Loader/PhpFileLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private function executeCallback(callable $callback, ContainerConfigurator $cont
102102
foreach ($parameters as $parameter) {
103103
$reflectionType = $parameter->getType();
104104
if (!$reflectionType instanceof \ReflectionNamedType) {
105-
throw new \InvalidArgumentException(sprintf('Could not resolve argument "%s" for "%s".', $parameter->getName(), $path));
105+
throw new \InvalidArgumentException(sprintf('Could not resolve argument "$%s" for "%s".', $parameter->getName(), $path));
106106
}
107107
$type = $reflectionType->getName();
108108

@@ -121,7 +121,7 @@ private function executeCallback(callable $callback, ContainerConfigurator $cont
121121
try {
122122
$configBuilder = $this->configBuilder($type);
123123
} catch (InvalidArgumentException | \LogicException $e) {
124-
throw new \InvalidArgumentException(sprintf('Could not resolve argument "%s" for "%s".', $type.' '.$parameter->getName(), $path), 0, $e);
124+
throw new \InvalidArgumentException(sprintf('Could not resolve argument "%s" for "%s".', $type.' $'.$parameter->getName(), $path), 0, $e);
125125
}
126126
$configBuilders[] = $configBuilder;
127127
$arguments[] = $configBuilder;
@@ -164,7 +164,7 @@ private function configBuilder(string $namespace): ConfigBuilderInterface
164164

165165
if (!$this->container->hasExtension($alias)) {
166166
$extensions = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
167-
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s". Looked for namespace "%s", found "%s".', $namespace, $namespace, $extensions ? implode('", "', $extensions) : 'none'));
167+
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s". Looked for namespace "%s", found "%s".', $namespace, $alias, $extensions ? implode('", "', $extensions) : 'none'));
168168
}
169169

170170
$extension = $this->container->getExtension($alias);

0 commit comments

Comments
 (0)