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

RouteCollectionInterface::map requires callable not RequestHandlerInterface #221

Closed willemstuursma closed 5 years ago

willemstuursma commented 5 years ago

\League\Route\RouteCollectionInterface::map requires a callable and not a \Psr\Http\Server\RequestHandlerInterface. I feel this is an oversight in PSR-15 compliance.

I assume this is so that the request handler can be instanciated lazily, but this could also be handled better by a dedicated lazy initializer like https://github.com/northwoods/lazy-middleware.

philipobenito commented 5 years ago

No, the route callable itself doesn’t need to me a midlleware, that’s intentional. It does ultimately get wrapped in one though