Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 260731b

Browse files
committed
minor changes
1 parent 865f202 commit 260731b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,15 @@ private function completeDefinition($id, Definition $definition)
7171

7272
$arguments = $definition->getArguments();
7373
foreach ($constructor->getParameters() as $index => $parameter) {
74-
$argumentExists = array_key_exists($index, $arguments);
75-
if ($argumentExists && '' !== $arguments[$index]) {
74+
if (array_key_exists($index, $arguments) && '' !== $arguments[$index]) {
7675
continue;
7776
}
7877

7978
try {
8079
if (!$typeHint = $parameter->getClass()) {
8180
// no default value? Then fail
8281
if (!$parameter->isOptional()) {
83-
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));
82+
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));
8483
}
8584

8685
// specifically pass the default value

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,4 +545,4 @@ class MultipleArgumentsOptionalScalarNotReallyOptional
545545
public function __construct(A $a, $foo = 'default_val', Lille $lille)
546546
{
547547
}
548-
}
548+
}

0 commit comments

Comments
 (0)