Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 6a4bf9f

Browse files
committed
Use http-interop process()
Instead of `__invoke()`, for forwards compatibility once PSR-15 is ratified.
1 parent 6d09019 commit 6a4bf9f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: src/MiddlewareListener.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Zend\Psr7Bridge\Psr7ServerRequest as Psr7Request;
2222
use Zend\Psr7Bridge\Psr7Response;
2323
use Zend\Router\RouteMatch;
24+
use Zend\Stratigility\Delegate\CallableDelegateDecorator;
2425
use Zend\Stratigility\MiddlewarePipe;
2526

2627
class MiddlewareListener extends AbstractListenerAggregate
@@ -81,13 +82,12 @@ public function onDispatch(MvcEvent $event)
8182
foreach ($routeMatch->getParams() as $key => $value) {
8283
$psr7Request = $psr7Request->withAttribute($key, $value);
8384
}
84-
$return = $pipe(
85-
$psr7Request,
86-
$psr7ResponsePrototype,
85+
$return = $pipe->process($psr7Request, new CallableDelegateDecorator(
8786
function (PsrServerRequestInterface $request, PsrResponseInterface $response) {
8887
throw ReachedFinalHandlerException::create();
89-
}
90-
);
88+
},
89+
$psr7ResponsePrototype
90+
));
9191
} catch (\Throwable $ex) {
9292
$caughtException = $ex;
9393
} catch (\Exception $ex) { // @TODO clean up once PHP 7 requirement is enforced

0 commit comments

Comments
 (0)