diff --git a/src/RouterCollector.php b/src/RouterCollector.php index 96ac679..01199a3 100644 --- a/src/RouterCollector.php +++ b/src/RouterCollector.php @@ -185,6 +185,9 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate private function resolve(string|array $closure, ControllerInterpreter $interpreter): Handler { if (is_array($closure)) { + if (is_string($closure[0])) { + $closure[0] = $this->container->get($closure[0]); + } return $interpreter->addRouteByString(... $closure); } if (!str_contains($closure, '@')) {