Skip to content

Commit 257a328

Browse files
committed
[DependencyInjection] Better exception when a configurator is not type hinted
1 parent d11a6df commit 257a328

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)