From 294a5fccc003c1ef7ca9b9fbbea19300f21febee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 21 Apr 2021 10:21:06 +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/Reduce.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HttpServer/Route/Reduce.php b/HttpServer/Route/Reduce.php index d71a5cf3..b4e10a18 100644 --- a/HttpServer/Route/Reduce.php +++ b/HttpServer/Route/Reduce.php @@ -6,6 +6,7 @@ namespace HttpServer\Route; use Closure; use HttpServer\IInterface\After; +use HttpServer\IInterface\Middleware; use Snowflake\Core\Json; class Reduce @@ -64,11 +65,10 @@ class Reduce public static function passable($stack, $pipe): Closure { return function ($passable) use ($stack, $pipe) { - if ($pipe instanceof Closure) { - return call_user_func($pipe, $passable, $stack); - } else { + if ($pipe instanceof Middleware) { return $pipe->onHandler($passable, $stack); } + return call_user_func($pipe, $passable, $stack); }; }