diff --git a/src/Container/HttpMethod.php b/src/Container/HttpMethod.php index 628f5d4..4950c16 100644 --- a/src/Container/HttpMethod.php +++ b/src/Container/HttpMethod.php @@ -15,14 +15,6 @@ enum HttpMethod: string public static function fromString(string $method): self { - return match (strtoupper($method)) { - 'GET' => self::GET, - 'POST' => self::POST, - 'PUT' => self::PUT, - 'DELETE' => self::DELETE, - 'HEAD' => self::HEAD, - 'OPTIONS' => self::OPTIONS, - default => throw new \InvalidArgumentException("Invalid HTTP method: $method"), - }; + return self::tryFrom(strtoupper($method)) ?? throw new \InvalidArgumentException("Invalid HTTP method: $method"); } }