This commit is contained in:
2021-08-02 18:15:00 +08:00
parent f1a7928192
commit 7c4dd74609
+7 -2
View File
@@ -245,9 +245,13 @@ class Container extends BaseObject
/** /**
* @param ReflectionClass|string $class * @param ReflectionClass|string $class
* @return ReflectionMethod[] * @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); return $this->getMethods($class);
} }
@@ -256,8 +260,9 @@ class Container extends BaseObject
* @param ReflectionClass|string $class * @param ReflectionClass|string $class
* @param string $method * @param string $method
* @return ReflectionMethod|null * @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; return $this->getReflectMethods($class)[$method] ?? null;
} }