From f02b540f628429ccb4cdcbff2a97e8fa6ac1c6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 13 Dec 2022 14:10:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LocalService.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/LocalService.php b/LocalService.php index 841caec..c719341 100644 --- a/LocalService.php +++ b/LocalService.php @@ -2,6 +2,7 @@ namespace Kiri\Di; +use Exception; use Kiri; @@ -22,7 +23,7 @@ class LocalService * @param $name * @param $define */ - public function set($name, $define) + public function set($name, $define): void { unset($this->_components[$name]); @@ -34,7 +35,7 @@ class LocalService /** - * @throws \Exception + * @throws Exception */ public function get(string $name, $throwException = true) { @@ -48,7 +49,7 @@ class LocalService } return $this->_components[$name] = Kiri::createObject($definition); } else if ($throwException) { - throw new \Exception("Unknown component ID: $name"); + throw new Exception("Unknown component ID: $name"); } return null; } @@ -57,7 +58,7 @@ class LocalService /** * @param array $components */ - public function setComponents(array $components) + public function setComponents(array $components): void { foreach ($components as $name => $component) { $this->set($name, $component);