From effee75d57e1cfe1b7c60ededa47c412cbaea9f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 18 Aug 2021 11:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Annotation/Inject.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Annotation/Inject.php b/Annotation/Inject.php index 5e15b8aa..509fc4c3 100644 --- a/Annotation/Inject.php +++ b/Annotation/Inject.php @@ -21,9 +21,9 @@ use ReflectionProperty; /** * Inject constructor. * @param string $value - * @param array $args + * @param array $construct */ - public function __construct(private string $value, private array $args = []) + public function __construct(private string $value, private array $construct = []) { } @@ -93,7 +93,10 @@ use ReflectionProperty; private function parseInjectValue(): mixed { if (!Kiri::app()->has($this->value)) { - return Kiri::getDi()->get($this->value, $this->args); + if (!empty($this->construct)) { + return Kiri::getDi()->newObject($this->value, $this->construct); + } + return Kiri::getDi()->get($this->value); } else { return Kiri::app()->get($this->value); }