mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-12 11:29:36 +00:00
Update src/Container/HttpMethod.php
improve fromString Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
This commit is contained in:
co-authored by
Jacob Dreesen
parent
5b42abf081
commit
662acfefa1
@@ -15,14 +15,6 @@ enum HttpMethod: string
|
|||||||
|
|
||||||
public static function fromString(string $method): self
|
public static function fromString(string $method): self
|
||||||
{
|
{
|
||||||
return match (strtoupper($method)) {
|
return self::tryFrom(strtoupper($method)) ?? throw new \InvalidArgumentException("Invalid HTTP method: $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"),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user