This commit is contained in:
xl
2024-08-29 13:46:16 +08:00
parent be1badfa5c
commit b2e641c159
+2 -12
View File
@@ -6,19 +6,16 @@ namespace Kiri\Router;
use Closure; use Closure;
use Exception;
use Kiri; use Kiri;
use Kiri\Router\Base\NotFoundController; use Kiri\Router\Base\NotFoundController;
use Kiri\Router\Constrict\RequestMethod; use Kiri\Router\Constrict\RequestMethod;
use Kiri\Di\Inject\Container; use Kiri\Di\Inject\Container;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use ReflectionException;
use ReflectionMethod; use ReflectionMethod;
use Throwable; use Throwable;
use Traversable; use Traversable;
use Kiri\Router\Base\Middleware; use Kiri\Router\Base\Middleware;
use Kiri\Router\Format\ResponseFormat;
/** /**
@@ -58,12 +55,6 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
protected array $httpHandler = []; protected array $httpHandler = [];
/**
* @var array<string, object>
*/
protected array $controllers = [];
/** /**
* @var Handler * @var Handler
*/ */
@@ -91,8 +82,7 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
{ {
$found = di(NotFoundController::class); $found = di(NotFoundController::class);
$reflection = new ReflectionMethod($found, 'fail'); $this->found = new Handler([$found, 'fail'], [], ResponseFormat::class);
$this->found = new Handler([$found, 'fail'], $reflection);
} }