From 4bb4503c4886ba59bb1b2cb31b1718727faf5521 Mon Sep 17 00:00:00 2001 From: Tlapi Date: Thu, 29 Aug 2024 15:07:20 +0200 Subject: [PATCH] switch to php enums --- src/Http/Method.php | 14 ++++++-------- src/Http/ResponseHydrator.php | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Http/Method.php b/src/Http/Method.php index 6540c89..09264ef 100644 --- a/src/Http/Method.php +++ b/src/Http/Method.php @@ -4,20 +4,18 @@ namespace EcomailFlexibee\Http; -use Consistence\Enum\Enum; - -final class Method extends Enum +enum Method: string { - public const GET = 'GET'; - public const POST = 'POST'; - public const DELETE = 'DELETE'; - public const PUT = 'PUT'; + case GET = 'GET'; + case POST = 'POST'; + case DELETE = 'DELETE'; + case PUT = 'PUT'; public function __toString(): string { /** @phpstan-ignore-next-line */ - return $this->getValue(); + return $this->value; } } diff --git a/src/Http/ResponseHydrator.php b/src/Http/ResponseHydrator.php index ea7d9dc..e7becaa 100644 --- a/src/Http/ResponseHydrator.php +++ b/src/Http/ResponseHydrator.php @@ -4,7 +4,6 @@ namespace EcomailFlexibee\Http; -use Consistence\ObjectPrototype; use EcomailFlexibee\Config; use EcomailFlexibee\Exception\EcomailFlexibeeNoEvidenceResult; use EcomailFlexibee\Exception\EcomailFlexibeeRequestFail; @@ -13,7 +12,7 @@ use function array_map; use function count; -class ResponseHydrator extends ObjectPrototype +class ResponseHydrator { public function __construct(private Config $config)