From 6677193b3508471b7e6adc594f3567559a9ddb26 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 12 Dec 2019 12:04:25 +0800 Subject: [PATCH] add clear --- Container.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Container.php b/Container.php index 7260f62..ae27206 100644 --- a/Container.php +++ b/Container.php @@ -77,10 +77,14 @@ class Container /** * @param $name - * @return mixed + * @return mixed|object|ReflectionClass + * @throws ReflectionException */ public function get($name) { + if (!isset($this->container[$name])) { + return $this->createObject($name); + } return $this->container[$name]; }