Closed dbu closed 8 years ago
That's correct, because a server middleware is a superset of a middleware. There is no situation in which a middleware would need to implement both. The rules are quite simple:
ServerRequest
, it implements MiddlewareInterface
.ServerRequest
, it implements ServerMiddlewareInterface
.Having separate methods would imply that a single middleware would have different behavior in different contexts, which is a violation of SRP.
ah right, makes sense. i felt that if its a server middleware it must implement ServerMiddleware, but if it can just implement Middleware its all fine.
Middleware and ServerMiddleware both use the method process. This means that a class can't implement both interfaces. While many plugins will be specific for either client or server, the PSR should not prevent plugins that make sense as both from implementing both interfaces. If the method on ServerMiddleware would be called processServer, a class could implement both interfaces.