diff --git a/src/ControllerInterpreter.php b/src/ControllerInterpreter.php index 92f6945..34a74ce 100644 --- a/src/ControllerInterpreter.php +++ b/src/ControllerInterpreter.php @@ -72,7 +72,7 @@ class ControllerInterpreter $container = \Kiri::getDi(); $parameters = $container->getMethodParams($reflectionMethod); - return new Handler([$reflectionClass->getName(), $reflectionMethod->getName()], $parameters); + return new Handler([$container->get($reflectionClass->getName()), $reflectionMethod->getName()], $parameters); } } diff --git a/src/RouterCollector.php b/src/RouterCollector.php index 7d7e60c..678a49d 100644 --- a/src/RouterCollector.php +++ b/src/RouterCollector.php @@ -179,10 +179,11 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate /** * @param string $path * @return Handler + * @throws ReflectionException */ private function NotFundHandler(string $path): Handler { - return new Handler([NotFoundController::class, 'fail'], []); + return new Handler([di(NotFoundController::class), 'fail'], []); } /**