Skip to content

Commit 22494a3

Browse files
committed
Helpers::autowireArguments() checks for isDefaultValueAvailable() instead of isOptional()
Works with signatures like function($a = NULL, $b) since PHP 5.3.17
1 parent 43c60cd commit 22494a3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/DI/Helpers.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ public static function autowireArguments(\ReflectionFunctionAbstract $method, ar
116116
$optCount = 0;
117117
}
118118

119-
} elseif ($parameter->isOptional()) {
120-
// PDO::__construct has optional parameter without default value (and isArray() and allowsNull() returns FALSE)
121-
$res[$num] = $parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : NULL;
119+
} elseif ($parameter->isDefaultValueAvailable()) {
120+
$res[$num] = $parameter->getDefaultValue();
122121
$optCount++;
123122

124123
} else {

0 commit comments

Comments
 (0)