PHP-DI / Slim-Bridge

PHP-DI integration with the Slim framework
http://php-di.org/doc/frameworks/slim.html
MIT License
176 stars 38 forks source link

Added support for PSR-15 middleware resolving #70

Closed danae closed 2 years ago

danae commented 3 years ago

Fixes #51 by using the code supplied by kakenbok in https://github.com/PHP-DI/Slim-Bridge/issues/51#issuecomment-820936631. Added a test case that passes as well.

Rarst commented 3 years ago

Hmm, I think injecting second resolver might be overkill for the problem. MiddlewareDispatcher->addDeferred() already has the logic to handle this, if provided resolver failed. See https://github.com/slimphp/Slim/blob/8294d20e016b01ba57eb2cdb8c0f59cde502d1ab/Slim/MiddlewareDispatcher.php#L214-L237

The current issue is that Invoker throws exception that Slim doesn't expect and catch there, so fallback code is never reached.

Might throwing the expected exception and letting Slim get on with it be a lighter solution?

Rarst commented 3 years ago

Possibly might be better improved upstream too, opened an issue there https://github.com/slimphp/Slim/issues/3071

mnapoli commented 2 years ago

Thank you, we've merged #71 instead.