thephpleague / route

Fast PSR-7 based routing and dispatch component including PSR-15 middleware, built on top of FastRoute.
http://route.thephpleague.com
MIT License
651 stars 126 forks source link

MiddlewareAwareInterface could be more strict #207

Closed shadowhand closed 5 years ago

shadowhand commented 6 years ago

The middlewares() method currently takes an array of middleware but there is no type enforcement.

This method could be improved by using a variadic method definition:

public function middlewares(MiddlewareInterface ...$middlewares)

When combined with argument unpacking, it makes it easy to pass an array:

$aware->middlewares(...$arrayOfMiddleware);

This can only be implemented in the next major version.

philipobenito commented 6 years ago

See #186 relating to this.