Update src/Container/HttpMethod.php

improve fromString

Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
This commit is contained in:
Sergei Shitikov
2024-10-27 21:32:47 +01:00
committed by GitHub
co-authored by Jacob Dreesen
parent 5b42abf081
commit 662acfefa1
+1 -9
View File
@@ -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");
}
}