From 7c4dd7460946ed8bbd06a50f302dd9b3754b019a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 2 Aug 2021 18:15:00 +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 --- System/Di/Container.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/System/Di/Container.php b/System/Di/Container.php index 67a22300..3628dac3 100644 --- a/System/Di/Container.php +++ b/System/Di/Container.php @@ -245,9 +245,13 @@ class Container extends BaseObject /** * @param ReflectionClass|string $class * @return ReflectionMethod[] + * @throws ReflectionException */ - #[Pure] public function getReflectMethods(ReflectionClass|string $class): array + public function getReflectMethods(ReflectionClass|string $class): array { + if (is_string($class)) { + $class = $this->getReflect($class); + } return $this->getMethods($class); } @@ -256,8 +260,9 @@ class Container extends BaseObject * @param ReflectionClass|string $class * @param string $method * @return ReflectionMethod|null + * @throws ReflectionException */ - #[Pure] public function getReflectMethod(ReflectionClass|string $class, string $method): ?ReflectionMethod + public function getReflectMethod(ReflectionClass|string $class, string $method): ?ReflectionMethod { return $this->getReflectMethods($class)[$method] ?? null; }