diff --git a/src/ControllerInterpreter.php b/src/ControllerInterpreter.php index 9ba1e27..d180ed3 100644 --- a/src/ControllerInterpreter.php +++ b/src/ControllerInterpreter.php @@ -87,9 +87,9 @@ class ControllerInterpreter $method = $reflectionMethod->getName(); - $call = static function (RequestInterface $request) use ($class, $method, $parameters) { - /** @var ResponseInterface $response */ - $response = \Kiri::service()->get('response'); + /** @var ResponseInterface $response */ + $response = \Kiri::service()->get('response'); + $call = static function (RequestInterface $request) use ($response, $class, $method, $parameters) { if (!$class->beforeAction($request)) { return $response->withStatus(500); }