From ae48aca021050d9350ae0a1843a1bc6630ed6e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 16 Apr 2023 13:26:19 +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 --- function.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/function.php b/function.php index ac21a771..fc92757b 100644 --- a/function.php +++ b/function.php @@ -929,12 +929,15 @@ if (!function_exists('di')) { /** - * @param string $className + * @param string|object $className * @return mixed * @throws ReflectionException */ - function di(string $className): mixed + function di(string|object $className): mixed { + if (is_object($className)) { + return $className; + } return Kiri::getDi()->get($className); }