I see no reason to use __invoke for middleware. The spec requires a formal interface be used.
On Mon, Aug 15, 2016, 02:20 Alexandru Pătrănescu <[email protected]> wrote: > I'm comfortable with this approach. >> > > Great. > > But *MiddlewareInterface* is using *process* instead of *__invoke*. > Should we settle on one approach for both? > > > Alex > > On Sunday, August 14, 2016 at 9:20:22 PM UTC+3, Woody Gilk wrote: >> >> On Sun, Aug 14, 2016 at 12:32 PM, Matthieu Napoli <[email protected]> >> wrote: >> > so I wonder why we aren't using __invoke in that interface too >> > >> > That's a very good idea, it might be a good middle ground: >> > >> > >> > interface Next >> > >> > { >> > >> > public function __invoke(ServerRequestInterface $request) : >> > ResponseInterface; >> > >> > } >> >> I'm comfortable with this approach. The type hint would still have to >> be included, though: >> >> public function process(ServerRequestInterface $request, NextInterface >> $next) >> { >> return $next($request); >> } >> >> I also don't love name NextInterface but... naming things is hard. >> -- >> 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/etPan.57b0ab4a.72d7b9d0.16394%40mnapoli.fr. >> >> > >> > For more options, visit https://groups.google.com/d/optout. >> > > On Sunday, August 14, 2016 at 9:20:22 PM UTC+3, Woody Gilk wrote: >> >> On Sun, Aug 14, 2016 at 12:32 PM, Matthieu Napoli <[email protected]> >> wrote: >> > so I wonder why we aren't using __invoke in that interface too >> > >> > That's a very good idea, it might be a good middle ground: >> > >> > >> > interface Next >> > >> > { >> > >> > public function __invoke(ServerRequestInterface $request) : >> > ResponseInterface; >> > >> > } >> >> I'm comfortable with this approach. The type hint would still have to >> be included, though: >> >> public function process(ServerRequestInterface $request, NextInterface >> $next) >> { >> return $next($request); >> } >> >> I also don't love name NextInterface but... naming things is hard. >> -- >> 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/etPan.57b0ab4a.72d7b9d0.16394%40mnapoli.fr. >> >> > >> > For more options, visit https://groups.google.com/d/optout. >> > > On Sunday, August 14, 2016 at 9:20:22 PM UTC+3, Woody Gilk wrote: >> >> On Sun, Aug 14, 2016 at 12:32 PM, Matthieu Napoli <[email protected]> >> wrote: >> > so I wonder why we aren't using __invoke in that interface too >> > >> > That's a very good idea, it might be a good middle ground: >> > >> > >> > interface Next >> > >> > { >> > >> > public function __invoke(ServerRequestInterface $request) : >> > ResponseInterface; >> > >> > } >> >> I'm comfortable with this approach. The type hint would still have to >> be included, though: >> >> public function process(ServerRequestInterface $request, NextInterface >> $next) >> { >> return $next($request); >> } >> >> I also don't love name NextInterface but... naming things is hard. >> -- >> 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/etPan.57b0ab4a.72d7b9d0.16394%40mnapoli.fr. >> >> > >> > For more options, visit https://groups.google.com/d/optout. >> > -- > 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/4359293e-a51a-4225-96bf-addf4e056699%40googlegroups.com > <https://groups.google.com/d/msgid/php-fig/4359293e-a51a-4225-96bf-addf4e056699%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAGOJM6%2BT6QcNAZGzaOK3Zd-Fe82acc%2BaZT9H_4KHsHk4s%3DtH0g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
