Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- `Innmind\Http\Method::query`

### Changed

- Requires PHP `8.5`
Expand Down
5 changes: 5 additions & 0 deletions src/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
enum Method
{
case get;
case query;
case post;
case put;
case patch;
Expand All @@ -31,6 +32,7 @@ public static function of(string $method): self
{
return match ($method) {
'GET' => self::get,
'QUERY' => self::query,
'POST' => self::post,
'PUT' => self::put,
'PATCH' => self::patch,
Expand Down Expand Up @@ -65,6 +67,7 @@ public function safe(): bool
{
return match ($this) {
self::get => true,
self::query => true,
self::post => false,
self::put => false,
self::patch => false,
Expand All @@ -83,6 +86,7 @@ public function idempotent(): bool
{
return match ($this) {
self::get => true,
self::query => true,
self::post => false,
self::put => true,
self::patch => false,
Expand All @@ -101,6 +105,7 @@ public function toString(): string
{
return match ($this) {
self::get => 'GET',
self::query => 'QUERY',
self::post => 'POST',
self::put => 'PUT',
self::patch => 'PATCH',
Expand Down
1 change: 1 addition & 0 deletions tests/MethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function methods(): Set
{
return Set\Elements::of(
'GET',
'QUERY',
'POST',
'PUT',
'PATCH',
Expand Down
Loading