From cee76c69c60393f8903c4703ba3e32884dd89cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 8 Feb 2021 17:20:43 +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 --- HttpServer/Route/Middleware.php | 6 ++---- HttpServer/Route/Node.php | 7 ++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/HttpServer/Route/Middleware.php b/HttpServer/Route/Middleware.php index 8cea2383..baa0c900 100644 --- a/HttpServer/Route/Middleware.php +++ b/HttpServer/Route/Middleware.php @@ -104,11 +104,9 @@ class Middleware */ protected function annotation(Node $node): array { - $middleWares = $this->annotation_limit($node); + $middleWares = $node->getMiddleWares(); + $middleWares = $this->annotation_limit($node, $middleWares); $middleWares = $this->annotation_interceptor($node, $middleWares); - foreach ($node->getMiddleWares() as $middleWare) { - $middleWares[] = $middleWare; - } return $middleWares; } diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index bfd4053b..608dbea1 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -10,6 +10,7 @@ use HttpServer\Http\Request; use Exception; use HttpServer\Application; +use JetBrains\PhpStorm\Pure; use ReflectionException; use Snowflake\Core\Json; use Snowflake\Exception\NotFindClassException; @@ -81,7 +82,7 @@ class Node extends Application /** * @return bool */ - public function hasInterceptor(): bool + #[Pure] public function hasInterceptor(): bool { return count($this->_interceptors) > 0; } @@ -90,7 +91,7 @@ class Node extends Application /** * @return bool */ - public function hasLimits(): bool + #[Pure] public function hasLimits(): bool { return count($this->_limits) > 0; } @@ -129,7 +130,7 @@ class Node extends Application /** * @return bool */ - public function hasAfter(): bool + #[Pure] public function hasAfter(): bool { return count($this->_after) > 0; }