From 978b9153870e2d4a866ea071a84c4c3d3d2bbea7 Mon Sep 17 00:00:00 2001 From: zafex Date: Tue, 15 Jan 2019 11:05:23 +0700 Subject: [PATCH] Selamat ulang tahun IBU --- src/Container.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Container.php b/src/Container.php index 814d9f7..a9a9567 100644 --- a/src/Container.php +++ b/src/Container.php @@ -239,8 +239,10 @@ protected function resolve(ReflectionFunctionAbstract $function, array $params) if ($class = $parameter->getClass()) { if (true === $this->has($class->getName())) { $parameters[] = $this->get($class->getName()); - } else { + } elseif ($class->isInstantiable() === true) { $parameters[] = $this->factory($class->getName()); + } else { + $parameters[] = $parameter->isOptional() ? $parameter->getDefaultValue() : null; } } else { $name = $parameter->getName();