Skip to content

Make ActionInterface use ServerRequestInterface#85

Merged
shadowhand merged 1 commit into
devfrom
fix/action-request-interface
Aug 17, 2016
Merged

Make ActionInterface use ServerRequestInterface#85
shadowhand merged 1 commit into
devfrom
fix/action-request-interface

Conversation

@bvisness

Copy link
Copy Markdown
Contributor

Although ActionHandler deals exclusively with ServerRequestInterface
instead of RequestInterface, ActionInterface used just
RequestInterface. This made it impossible for actions to use the
helpful features that ServerRequestInterface offers.

In particular, this bug actually rendered the example Action code in
the docs incorrect, because the variable $request (of type
RequestInterface) was passed as a parameter to input(), which expected
ServerRequestInterface.

Although ActionHandler deals exclusively with ServerRequestInterface
instead of RequestInterface, ActionInterface used just
RequestInterface. This made it impossible for actions to use the
helpful features that ServerRequestInterface offers.

In particular, this bug actually rendered the example Action code in
the docs incorrect, because the variable $request (of type
RequestInterface) was passed as a parameter to input(), which expected
ServerRequestInterface.
@elazar

elazar commented Aug 17, 2016

Copy link
Copy Markdown
Contributor

@bvisness Not sure I'd say it's impossible. It's still possible, albeit not necessarily ideal, to do this:

public function __invoke(
RequestInterface $request, ResponseInterface $response)
{
    if (!$request instanceof ServerRequestInterface) {
        // Throw some sort of error or some such here
    }
}

Changing this signature would be a breaking change. If we decide to release it, the above approach can be used in the interim.

@bvisness

Copy link
Copy Markdown
Contributor Author

@elazar ActionInterface is new in 3.0.0-alpha1, so shouldn't we be free to make breaking changes like this? (Besides, with 3.0.0-alpha1 released just earlier today, I might be the only one actually using it for anything...)

@shadowhand

shadowhand commented Aug 17, 2016

Copy link
Copy Markdown
Contributor

👍

Approved with PullApprove

@shadowhand

Copy link
Copy Markdown
Contributor

I don't know of any situation where Equip would be used with client requests, so this makes perfect sense. If it ends up being a problem for people, we can change it.

@shadowhand shadowhand merged commit edc1d96 into dev Aug 17, 2016
@shadowhand shadowhand deleted the fix/action-request-interface branch August 17, 2016 01:58
jeichorn pushed a commit to pagely/framework that referenced this pull request Jun 17, 2021
Although ActionHandler deals exclusively with ServerRequestInterface
instead of RequestInterface, ActionInterface used just
RequestInterface. This made it impossible for actions to use the
helpful features that ServerRequestInterface offers.

In particular, this bug actually rendered the example Action code in
the docs incorrect, because the variable $request (of type
RequestInterface) was passed as a parameter to input(), which expected
ServerRequestInterface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants