From 78ab933e506299a11deda9c833ea582157088987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 29 Apr 2021 10:38:37 +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 --- Annotation/Port.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Annotation/Port.php b/Annotation/Port.php index 7042a065..42e607b1 100644 --- a/Annotation/Port.php +++ b/Annotation/Port.php @@ -12,7 +12,7 @@ use Snowflake\Snowflake; * Class Port * @package Annotation */ -#[\Attribute(\Attribute::TARGET_METHOD)] class Port extends Attribute +#[\Attribute(\Attribute::TARGET_CLASS)] class Port extends Attribute { @@ -34,7 +34,10 @@ use Snowflake\Snowflake; public function execute(array $handler): mixed { $router = Snowflake::app()->getRouter(); - $router->addPortListen($this->port, $handler); + if (!($handler[0] instanceof Porters)) { + return true; + } + $router->addPortListen($this->port, [$handler[0], 'process']); return parent::execute($handler); }