I didn’t allow that. A RequestStack should accept only RequestMiddleware
instances and ServerRequestStack only ServerRequestMiddleware.
For middleware creators, this is not hard to implement:
abstract class DualMiddleware
{
protected function run($request, $frame)
{
//here the code
}
}
class RequestMiddleware extend DualMiddleware
{
public function handle(RequestInterface $request, FrameInterface $frame)
{
return $this->run($request, $frame);
}
}
class ServerRequestMiddleware extend DualMiddleware
{
public function handle(ServerRequestInterface $request, FrameInterface
$frame)
{
return $this->run($request, $frame);
}
}
I know that this can be a bit repetitive, but I my oppinion, better than having
an empty interface.
> El 20 jun 2016, a las 20:12, Woody Gilk <[email protected]> escribió:
>
> On Mon, Jun 20, 2016 at 12:41 PM, Oscar Otero <[email protected]> wrote:
>> I’d create two separate middleware stack and frame, because it makes no
>> sense to typehint the middleware in some places and not in others.
>
> Without the empty MiddlewareInterface, how would you declare type for
> a stack container that mixes both client and server middleware?
>
> --
> 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/CAGOJM6K9hAiFUQXk4gidtOgxZHJim9efrswXKDLN%3DMwg%2BzZCDQ%40mail.gmail.com.
> 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/34818DED-29EB-4C28-85C0-E151FE2991FD%40gmail.com.
For more options, visit https://groups.google.com/d/optout.