minor changes

This commit is contained in:
Ryan Weaver 2016-02-28 19:33:45 -05:00
parent 865f2029fd
commit 260731b806
2 changed files with 3 additions and 4 deletions

View File

@ -71,8 +71,7 @@ class AutowirePass implements CompilerPassInterface
$arguments = $definition->getArguments();
foreach ($constructor->getParameters() as $index => $parameter) {
$argumentExists = array_key_exists($index, $arguments);
if ($argumentExists && '' !== $arguments[$index]) {
if (array_key_exists($index, $arguments) && '' !== $arguments[$index]) {
continue;
}
@ -80,7 +79,7 @@ class AutowirePass implements CompilerPassInterface
if (!$typeHint = $parameter->getClass()) {
// no default value? Then fail
if (!$parameter->isOptional()) {
throw new RuntimeException(sprintf('Unable to autowire argument index %s ($%s) for the service "%s". If this is an object, give it a type-hint. Otherwise, specify this argument\'s value explicitly.', $index, $parameter->name, $id));
throw new RuntimeException(sprintf('Unable to autowire argument index %d ($%s) for the service "%s". If this is an object, give it a type-hint. Otherwise, specify this argument\'s value explicitly.', $index, $parameter->name, $id));
}
// specifically pass the default value

View File

@ -545,4 +545,4 @@ class MultipleArgumentsOptionalScalarNotReallyOptional
public function __construct(A $a, $foo = 'default_val', Lille $lille)
{
}
}
}