[DI] Fix by-type args injection
This commit is contained in:
parent
ecad1c4b3b
commit
2176be74d8
@ -68,15 +68,17 @@ class ResolveNamedArgumentsPass extends AbstractRecursivePass
|
||||
throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of %s or an instance of %s, %s given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, gettype($argument)));
|
||||
}
|
||||
|
||||
$typeFound = false;
|
||||
foreach ($parameters as $j => $p) {
|
||||
if (ProxyHelper::getTypeHint($r, $p, true) === $key) {
|
||||
if (!array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) {
|
||||
$resolvedArguments[$j] = $argument;
|
||||
|
||||
continue 2;
|
||||
$typeFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key));
|
||||
if (!$typeFound) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key));
|
||||
}
|
||||
}
|
||||
|
||||
if ($resolvedArguments !== $call[1]) {
|
||||
|
Reference in New Issue
Block a user