From 6df3d38880d56cc5a017b6d184b0f4d2cc4590a4 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 12 Dec 2019 12:05:22 +0800 Subject: [PATCH] add clear --- Container.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Container.php b/Container.php index ae27206..92ac13f 100644 --- a/Container.php +++ b/Container.php @@ -24,9 +24,10 @@ class Container const WX_OFFICIAL_ACCOUNT = 'WX_OFFICIAL_ACCOUNT'; /** - * @param string $class - * @param Config $config - * @return mixed + * @param $class + * @param $config + * @return mixed|object|ReflectionClass + * @throws ReflectionException */ public static function newInstance($class, $config) { @@ -38,7 +39,7 @@ class Container if (static::$_instance->exists($class)) { return static::$_instance->get($class); } else { - return static::$_instance->generate($config); + return static::$_instance->createObject($class); } } @@ -82,9 +83,6 @@ class Container */ public function get($name) { - if (!isset($this->container[$name])) { - return $this->createObject($name); - } return $this->container[$name]; }