8000 [DI] Autowiring: w/a https://bugs.php.net/62715 · symfony/symfony@8d49573 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8d49573

Browse files
[DI] Autowiring: w/a https://bugs.php.net/62715
1 parent 8a76fd9 commit 8d49573

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ private function completeDefinition($id, Definition $definition)
9191
try {
9292
$value = $this->createAutowiredDefinition($typeHint, $id 8000 );
9393
} catch (RuntimeException $e) {
94-
if (!$parameter->isDefaultValueAvailable()) {
94+
if ($parameter->allowsNull()) {
95+
$value = null;
96+
} elseif ($parameter->isDefaultValueAvailable()) {
97+
$value = $parameter->getDefaultValue();
98+
} else {
9599
throw $e;
96100
}
97-
98-
$value = $parameter->getDefaultValue();
99101
}
100102
}
101103
} catch (\ReflectionException $reflectionException) {

0 commit comments

Comments
 (0)
0