-
-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
Hi @Sammyjo20
I'm working on an app where users need to set the HTTP method of an outgoing request in the UI (stored as settings in the db). This includes users entering custom methods since not everyone sticks to just GET/POST/PUT/PATCH/etc.
The problem is that getMethod() returns the enum instance instead of the enum's case value. And then ->value
is used in the calling functions.
This makes it impossible to override getMethod()
to use dynamic custom values. Would you accept a PR that changes it to something this? Then it can be easily overriden with any custom logic.
/**
* Get the method of the request.
*/
public function getMethod(): string
{
if (! isset($this->method)) {
throw new LogicException('Your request is missing a HTTP method. You must add a method property like [protected Method $method = Method::GET]');
}
return $this->method->value;
}
Cheers
Metadata
Metadata
Assignees
Labels
No labels