On Thu, Jun 16, 2016 at 3:24 PM, Matthew Weier O'Phinney
<[email protected]> wrote:
>> It definitely does not need to include the StackInterface. However, I
>> feel that it is valuable to provide a recommendation for it because of
>> the aforementioned concerns around being able to use client middleware
>> in a server stack.
>
> I was stumbling on this, trying to figure out why client middleware wouldn't 
> be
> able to be used, as the ServerRequest fulfills the Request required by the
> client middleware ...  and then realized it's because of the separated
> interfaces bit (you wouldn't be able to compose the client middleware in your
> stack if you typehint on ServerMiddleware).
>
> As such, two pieces of feedback:
>
> - Would this functionality be useful? Is anybody actually doing that today? I
>   see some potential problems with it (e.g., what if the middleware
> creates a new
>   `RequestInterface` instance and passes it to `$frame->next()`?), and have 
> yet
>   to see a use case where I wouldn't just invoke that middleware directly 
> within
>   my server-side middleware.
>
>   I'm willing to be convinced its useful, but I think we need to demonstrate 
> the
>   need in the meta document if it really is.
>
> - Second, if it is useful, and thus we're keeping the MiddlewareInterface as a
>   marker interface, we need more narrative around this in the meta document
>   detailing what I wrote above. Those reading the spec and meta document 
> should
>   not need to fill in the blanks and reason it out; the meta document should 
> do
>   that.

I think I agree with you but am struggling to find a reasonable way to
document this in the meta document without making it too heavy on
implementation details. Would you be willing to create a PR that fills
in that section? I've started to detail it in my latest changes to the
PR [1].

[1]: https://github.com/php-fig/fig-standards/pull/774

Regarding this specifically:

> what if the middleware creates a new `RequestInterface` instance and passes 
> it to `$frame->next()`?

I have never seen a situation where the middleware would completely
replace the request. It should be assumed that the request can be
modified and passed, but not completely replaced. Do you think this
needs to be explicitly stated in the documentation?

--
Woody Gilk
http://about.me/shadowhand

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/CAGOJM6KcNbehEJfv6cNO2tj%3DRRoNUCfYoa1dn8FKo4kJBRNwww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to