From ecc077a1bef0a7a17b4c9ac833c5c659f362d8f5 Mon Sep 17 00:00:00 2001 From: PJ Dietz Date: Sun, 9 Aug 2020 11:45:41 -0400 Subject: [PATCH] Add type hints to Dispatch classes --- psalm.xml | 3 ++- src/Dispatching/DispatchStack.php | 19 ++++++++++++++++--- src/Dispatching/Dispatcher.php | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/psalm.xml b/psalm.xml index 30258a7..030ec2f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,7 +1,8 @@ stack) as $middleware) { - $chain = function ($request, $response) use ($dispatcher, $middleware, $chain) { - return $dispatcher->dispatch($middleware, $request, $response, $chain); + $chain = function ( + ServerRequestInterface $request, + ResponseInterface $response + ) use ($dispatcher, $middleware, $chain): ResponseInterface { + return $dispatcher->dispatch( + $middleware, + $request, + $response, + $chain + ); }; } diff --git a/src/Dispatching/Dispatcher.php b/src/Dispatching/Dispatcher.php index 5e6a76f..f420c4f 100644 --- a/src/Dispatching/Dispatcher.php +++ b/src/Dispatching/Dispatcher.php @@ -67,6 +67,10 @@ class Dispatcher implements DispatcherInterface } } + /** + * @param mixed[] $dispatchables + * @return DispatchStack + */ protected function getDispatchStack($dispatchables) { $stack = new DispatchStack($this);