From a9964ebf4420d9598fc35b4066a1d54cda929f71 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 5 Feb 2015 18:41:00 +0100 Subject: [PATCH] Helpers::autowireArguments() checks for isDefaultValueAvailable() instead of isOptional() Works with signatures like function($a = NULL, $b) since PHP 5.3.17 --- src/DI/Helpers.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/DI/Helpers.php b/src/DI/Helpers.php index 412db989e..194d99bf7 100644 --- a/src/DI/Helpers.php +++ b/src/DI/Helpers.php @@ -116,9 +116,8 @@ public static function autowireArguments(\ReflectionFunctionAbstract $method, ar $optCount = 0; } - } elseif ($parameter->isOptional()) { - // PDO::__construct has optional parameter without default value (and isArray() and allowsNull() returns FALSE) - $res[$num] = $parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : NULL; + } elseif ($parameter->isDefaultValueAvailable()) { + $res[$num] = $parameter->getDefaultValue(); $optCount++; } else {