From 7dcfd459866af7379bcde8b4545c3e5f43f495a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Feb 2021 14:54:47 +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/Route/After.php | 5 +++-- Annotation/Route/Interceptor.php | 2 +- Annotation/Route/Limits.php | 5 +++-- Annotation/Route/Middleware.php | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Annotation/Route/After.php b/Annotation/Route/After.php index 7696b0a0..81fe06c7 100644 --- a/Annotation/Route/After.php +++ b/Annotation/Route/After.php @@ -5,6 +5,7 @@ namespace Annotation\Route; use Annotation\IAnnotation; +use JetBrains\PhpStorm\Pure; use ReflectionException; use Snowflake\Exception\NotFindClassException; use Snowflake\Snowflake; @@ -23,10 +24,10 @@ use Snowflake\Snowflake; * @param \HttpServer\IInterface\After|\HttpServer\IInterface\After[] $after * @throws */ - public function __construct(public string|array $after) + #[Pure] public function __construct(public string|array $after) { if (is_string($this->after)) { - $this->after = []; + $this->after = [$this->after]; } } diff --git a/Annotation/Route/Interceptor.php b/Annotation/Route/Interceptor.php index 80879f95..21b84b89 100644 --- a/Annotation/Route/Interceptor.php +++ b/Annotation/Route/Interceptor.php @@ -27,7 +27,7 @@ use Snowflake\Snowflake; #[Pure] public function __construct(public string|array $interceptor) { if (is_string($this->interceptor)) { - $this->interceptor = []; + $this->interceptor = [$this->interceptor]; } } diff --git a/Annotation/Route/Limits.php b/Annotation/Route/Limits.php index fc306df3..47b04845 100644 --- a/Annotation/Route/Limits.php +++ b/Annotation/Route/Limits.php @@ -5,6 +5,7 @@ namespace Annotation\Route; use Annotation\IAnnotation; +use JetBrains\PhpStorm\Pure; use ReflectionException; use Snowflake\Exception\NotFindClassException; use Snowflake\Snowflake; @@ -23,10 +24,10 @@ use Snowflake\Snowflake; * @param string|array $limits * @throws */ - public function __construct(public string|array $limits) + #[Pure] public function __construct(public string|array $limits) { if (is_string($this->limits)) { - $this->limits = []; + $this->limits = [$this->limits]; } } diff --git a/Annotation/Route/Middleware.php b/Annotation/Route/Middleware.php index 0c7da535..e0d24731 100644 --- a/Annotation/Route/Middleware.php +++ b/Annotation/Route/Middleware.php @@ -25,10 +25,10 @@ use Snowflake\Snowflake; * @param string|array $middleware * @throws */ - public function __construct(public string|array $middleware) + #[Pure] public function __construct(public string|array $middleware) { if (is_string($this->middleware)) { - $this->middleware = []; + $this->middleware = [$this->middleware]; } }