On Mon, Aug 15, 2016 at 7:53 AM, Matthieu Napoli <
matt...@mnapoli.fr> wrote:
> Thanks Woody for your answer. Such information should be in the META
> document, else we are bound to discuss all this over and over.
>
> Back to the topic: I don't see how the interface helps. If I'm writing a
> server middleware stack, I'll type-hint against ServerMiddlewareInterface
> (and vice-versa if it's a client middleware stack).
Ah, but this is exactly the problem I am trying to avoid. A server
middleware stack should NOT type hint against the server interface,
because client middleware is compatible with server middleware, but
not vice versa. This is why we have the generic middleware interface
in the first place.
>
> Right, so how is the interface helping since it's type-hinting against the
> root "MiddlewareInterface"? It will prevent implementors from type-hinting
> against a more specific interface so I don't see the point. I'm missing
> something here.
See above. Again StackInterface exists for illustration only and is
only a "MAY" recommendation, which is entirely optional.
>> Now it could certainly be argued that having the StackInterface is out of
>> scope for the spec and I wouldn't disagree. However, any removal [2] should
>> be accompanied by an update to the middleware meta document to describe how
>> the type hints should be used.
>
> What do you mean by that?
Exactly the scenario that I described above and in the post I
referenced earlier:
If your stack accepts server middleware AND client middleware, type
hint against MiddlewareInterface.
If your stack accepts ONLY client middleware, type hint against
ClientMiddlewareInterface.
If your stack accepts ONLY server middleware, type hint against
ServerMiddlewareInterface. (I've never seen a use case for this.)
I will now self-throttle until tomorrow. Further discussions can be
done via Github PR.
> --
> 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
php-fig+u...@googlegroups.com.
> To post to this group, send email to
php...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/php-fig/0337e9ae-a8a1-45c3-a84d-02b412534e37%40googlegroups.com.