diff --git a/VERSION b/VERSION index 34a7134..b6aa7b2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2403.282019 +0.2403.282022 diff --git a/src/Http/Routing/HandlerAttribute.php b/src/Http/Routing/HandlerAttribute.php index 120e682..d7f758c 100644 --- a/src/Http/Routing/HandlerAttribute.php +++ b/src/Http/Routing/HandlerAttribute.php @@ -5,15 +5,13 @@ namespace Index\Http\Routing; -use Attribute; use ReflectionAttribute; use ReflectionObject; /** - * Provides an attribute for marking methods in a class as handlers. + * Provides base for attributes that mark methods in a class as handlers. */ -#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] -class HandlerAttribute { +abstract class HandlerAttribute { public function __construct(private string $path) {} /** diff --git a/src/Http/Routing/HttpDelete.php b/src/Http/Routing/HttpDelete.php index e732d42..475542c 100644 --- a/src/Http/Routing/HttpDelete.php +++ b/src/Http/Routing/HttpDelete.php @@ -5,9 +5,12 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as a DELETE route. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpDelete extends HttpRoute { public function __construct(string $path) { parent::__construct('DELETE', $path); diff --git a/src/Http/Routing/HttpGet.php b/src/Http/Routing/HttpGet.php index 574f311..f959d1d 100644 --- a/src/Http/Routing/HttpGet.php +++ b/src/Http/Routing/HttpGet.php @@ -5,9 +5,12 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as a GET route. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpGet extends HttpRoute { public function __construct(string $path) { parent::__construct('GET', $path); diff --git a/src/Http/Routing/HttpMiddleware.php b/src/Http/Routing/HttpMiddleware.php index 139adb8..07d7324 100644 --- a/src/Http/Routing/HttpMiddleware.php +++ b/src/Http/Routing/HttpMiddleware.php @@ -5,7 +5,10 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as middleware. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpMiddleware extends HandlerAttribute {} diff --git a/src/Http/Routing/HttpOptions.php b/src/Http/Routing/HttpOptions.php index 613d8da..d1dc7e9 100644 --- a/src/Http/Routing/HttpOptions.php +++ b/src/Http/Routing/HttpOptions.php @@ -5,9 +5,12 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as a OPTIONS route. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpOptions extends HttpRoute { public function __construct(string $path) { parent::__construct('OPTIONS', $path); diff --git a/src/Http/Routing/HttpPatch.php b/src/Http/Routing/HttpPatch.php index 286df02..6798f6d 100644 --- a/src/Http/Routing/HttpPatch.php +++ b/src/Http/Routing/HttpPatch.php @@ -5,9 +5,12 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as a POST route. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpPatch extends HttpRoute { public function __construct(string $path) { parent::__construct('PATCH', $path); diff --git a/src/Http/Routing/HttpPost.php b/src/Http/Routing/HttpPost.php index 9551210..9ca1a29 100644 --- a/src/Http/Routing/HttpPost.php +++ b/src/Http/Routing/HttpPost.php @@ -5,9 +5,12 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as a POST route. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpPost extends HttpRoute { public function __construct(string $path) { parent::__construct('POST', $path); diff --git a/src/Http/Routing/HttpPut.php b/src/Http/Routing/HttpPut.php index 1f9c08b..8fffa59 100644 --- a/src/Http/Routing/HttpPut.php +++ b/src/Http/Routing/HttpPut.php @@ -5,9 +5,12 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as a PUT route. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpPut extends HttpRoute { public function __construct(string $path) { parent::__construct('PUT', $path); diff --git a/src/Http/Routing/HttpRoute.php b/src/Http/Routing/HttpRoute.php index e3c1ef1..4f845ed 100644 --- a/src/Http/Routing/HttpRoute.php +++ b/src/Http/Routing/HttpRoute.php @@ -5,9 +5,12 @@ namespace Index\Http\Routing; +use Attribute; + /** * Provides an attribute for marking methods in a class as a route. */ +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class HttpRoute extends HandlerAttribute { private string $method;