Thanks Woody and Andrew for your answers,

Type safety is a valid point. I'm all for type safety, however in this case 
I'm not convinced it's worth it since it's just a callable that takes a 
request and returns a response. It can't be any simpler (except maybe no 
arguments), and sometimes simplicity can outweigh doing everything by the 
book.

I think it's worth considering, especially because if you look at existing 
PSR-7 middlewares (expressive, slim, etc.), they use "callable $next".

We have no idea how convenient it is (or not) to have that FrameInterface, 
because currently nobody uses that. It's risky to standardize something 
that nobody uses.

TL/DR: reality trumps theory.

Also I want to say how important the meta document is: it should contain 
justification for everything that was decided in a PSR.

Le vendredi 29 juillet 2016 15:42:41 UTC+2, Woody Gilk a écrit :
>
> On Fri, Jul 29, 2016 at 4:14 AM, Matthieu Napoli <matt...@mnapoli.fr 
> <javascript:>> wrote: 
> > 
> > - FrameInterface doesn't represent any actual usage or existing 
> middlewares today 
> > - FrameInterface is more complex than `callable` 
>
>
> From Anthony's blog post 
> http://blog.ircmaxell.com/2016/05/all-about-middleware.html : 
>
> > The fact that $next parameter is simply a callable also suffers from the 
> same problem as above. It means that there's no longer any enforcement or 
> ability to auto-complete or check types. 
> > 
> > Instead, $next should be a formal interface which would allow for type 
> validation. 
>
> I agree with his position. Having a formal interface ensures correct 
> return type declarations in PHP 7. It shifts responsibility from the 
> user having to know what is expected to be able to have a direct type 
> hint that ensures accuracy. 
>
> I recommend reading the entire article, it covers a lot why PSR-15 
> looks like it does, and why we need PSR-17. 
>
> -- 
> 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 php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/84259821-f77f-4273-bdb7-b5f222629e62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to