Skip to content

Commit 3b05369

Browse files
committed
minor #40930 [DependencyInjection] Better exception when a configurator is not type hinted (lyrixx)
This PR was merged into the 5.3-dev branch. Discussion ---------- [DependencyInjection] Better exception when a configurator is not type hinted | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | This would help with such BC break: markitosgv/JWTRefreshTokenBundle#241 Commits ------- 25813e3804 [DependencyInjection] Better exception when a configurator is not type hinted
2 parents f84d036 + 257a328 commit 3b05369

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)