8000 minor #40930 [DependencyInjection] Better exception when a configurat… · symfony/symfony@3c76625 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c76625

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 ------- 25813e3 [DependencyInjection] Better exception when a configurator is not type hinted
2 parents 10ced7a + 25813e3 commit 3c76625

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