10000 [DependencyInjection] Better exception when a configurator is not typ… · symfony/symfony@25813e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 25813e3

Browse files
committed
[DependencyInjection] Better exception when a configurator is not type hinted
1 parent abeb8e4 commit 25813e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php

Lines changed: 1 addition & 1 deletion
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". You must typehint it (for example with "%s" or "%s").', $parameter->getName(), $path, ContainerConfigurator::class, ContainerBuilder::class));
106106
}
107107
$type = $reflectionType->getName();
108108

0 commit comments

Comments
 (0)
0