From 9ba40e5fd7ad90be1e45cce04a13a6e91e0f237a Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Mon, 29 Mar 2021 03:39:53 +0800 Subject: [PATCH] modify --- System/Aop.php | 9 +++------ System/Error/LoggerAspect.php | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/System/Aop.php b/System/Aop.php index 2b07a10d..e34b2433 100644 --- a/System/Aop.php +++ b/System/Aop.php @@ -51,16 +51,13 @@ class Aop extends Component return call_user_func($close, ...$get_args); } - $reflect = new \ReflectionClass($this->_aop[$aopName]); - if (!$reflect->hasMethod('invoke')) { + $reflect = Snowflake::getDi()->getReflect($this->_aop[$aopName]); + if (!$reflect->isInstantiable() || !$reflect->hasMethod('invoke')) { throw new \Exception(ASPECT_ERROR . IAspect::class); } $method = $reflect->getMethod('invoke'); - $data = $method->invokeArgs($reflect->newInstance($close), $get_args); - if ($method->getReturnType() !== null) { - return $data; - } + return $method->invokeArgs($reflect->newInstance($close), $get_args); } diff --git a/System/Error/LoggerAspect.php b/System/Error/LoggerAspect.php index e6048b17..6d30f75a 100644 --- a/System/Error/LoggerAspect.php +++ b/System/Error/LoggerAspect.php @@ -22,7 +22,7 @@ class LoggerAspect implements IAspect * LoggerAspect constructor. * @param array $handler */ - public function __construct(public array $handler, $needReturn) + public function __construct(public array $handler) { $this->className = get_class($this->handler[0]); $this->methodName = $this->handler[1];