Solve https://github.com/PHP-DI/Slim-Bridge/issues/51 #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It fixes PHP-DI/Slim-Bridge#51
This package is a dependency of
php-di/slim-bridge
.I remind that the
php-di/Invoker
breakes the PSR-15 middleware resolving in the Slim microframework. When one writes$app->add(SomeMiddleware::class)
it causes displayingNotCallableException
.To fix it - a couple of the code strings should be added (see below).
What was generally done in the pull-request code:
1) Adding the
psr/http-server-middleware
package to therequire
(composer.json) section to haveMiddlewareInterface
2) Adding to the
resolve
method of theInvoker\CallableResolver
class the following code:3) Adding a unit-test method checking middleware resolving
4) Adding four mock classes for the new test method:
Middleware
,Request
,RequestHandler
,Response
Also I want you to pay attention that the
php-di/slim-bridge
package has the performance problem: its dependency (this package) duplicates the routing code from theSlim\Routing\Route
class. See detailed information - PHP-DI/Slim-Bridge#51 (comment)