From 1a1b2967f4dc5cb35ec1acaa40f5ffd378738bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 26 Oct 2021 10:21:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-core/Constrict/Request.php | 2 +- http-core/Constrict/Response.php | 2 +- http-core/Server.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/http-core/Constrict/Request.php b/http-core/Constrict/Request.php index eac713d2..79a3197c 100644 --- a/http-core/Constrict/Request.php +++ b/http-core/Constrict/Request.php @@ -2,7 +2,7 @@ namespace Http\Constrict; -use Http\Handler\Context; +use Server\Context; use Http\Handler\AuthIdentity; use JetBrains\PhpStorm\Pure; use Kiri\Kiri; diff --git a/http-core/Constrict/Response.php b/http-core/Constrict/Response.php index c743b1da..f4021e4e 100644 --- a/http-core/Constrict/Response.php +++ b/http-core/Constrict/Response.php @@ -4,7 +4,7 @@ namespace Http\Constrict; -use Http\Handler\Context; +use Server\Context; use Http\Message\ContentType; use JetBrains\PhpStorm\Pure; use Kiri\Abstracts\Config; diff --git a/http-core/Server.php b/http-core/Server.php index 39a81030..545edb8f 100644 --- a/http-core/Server.php +++ b/http-core/Server.php @@ -47,13 +47,10 @@ class Server implements OnRequestInterface /** - * @param ContainerInterface $container + * @var ContainerInterface */ - public function __construct(protected ContainerInterface $container) - { - $this->container->setBindings(RequestInterface::class, Constrict\Request::class); - $this->container->setBindings(ResponseInterface::class, Constrict\Response::class); - } + #[Inject(ContainerInterface::class)] + protected ContainerInterface $container; /** @@ -61,6 +58,9 @@ class Server implements OnRequestInterface */ public function init() { + $this->container->setBindings(RequestInterface::class, Constrict\Request::class); + $this->container->setBindings(ResponseInterface::class, Constrict\Response::class); + $exceptionHandler = Config::get('exception.http', ExceptionHandlerDispatcher::class); if (!in_array(ExceptionHandlerInterface::class, class_implements($exceptionHandler))) { $exceptionHandler = ExceptionHandlerDispatcher::class;