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]; } }