From 5ed5ee5ca92f9bcb517d6f1cb9ecfc9fb05fbd53 Mon Sep 17 00:00:00 2001 From: xl Date: Thu, 16 Nov 2023 23:50:06 +0800 Subject: [PATCH] eee --- kiri-engine/Abstracts/Component.php | 5 +++-- kiri-engine/Application.php | 15 +++++++-------- kiri-engine/Error/ErrorHandler.php | 11 ++++------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/kiri-engine/Abstracts/Component.php b/kiri-engine/Abstracts/Component.php index a5a7ef7f..cb174302 100644 --- a/kiri-engine/Abstracts/Component.php +++ b/kiri-engine/Abstracts/Component.php @@ -13,6 +13,7 @@ namespace Kiri\Abstracts; use Exception; use JetBrains\PhpStorm\Pure; use Kiri; +use Kiri\Error\StdoutLogger; use ReflectionException; /** @@ -49,10 +50,10 @@ class Component implements Configure /** - * @return Kiri\Error\StdoutLogger + * @return StdoutLogger * @throws ReflectionException */ - public function getLogger(): Kiri\Error\StdoutLogger + public function getLogger(): StdoutLogger { return Kiri::getLogger(); } diff --git a/kiri-engine/Application.php b/kiri-engine/Application.php index eaa37ef4..4da61ecb 100644 --- a/kiri-engine/Application.php +++ b/kiri-engine/Application.php @@ -23,8 +23,9 @@ use Symfony\Component\Console\{Application as ConsoleApplication, Exception\ExceptionInterface, Input\ArgvInput, Output\ConsoleOutput, - Output\OutputInterface}; -use Kiri\Server\Events\OnWorkerStart; + Output\OutputInterface +}; +use Kiri\Di\Inject\Container; /** * Class Init @@ -44,12 +45,10 @@ class Application extends BaseApplication /** - * @param ErrorHandler $errorHandler + * @var ErrorHandler */ - public function __construct(public ErrorHandler $errorHandler) - { - parent::__construct(); - } + #[Container(ErrorHandler::class)] + public ErrorHandler $errorHandler; /** @@ -163,5 +162,5 @@ class Application extends BaseApplication fire(new OnAfterCommandExecute($command)); $output->writeln('execute complete.' . PHP_EOL); } - + } diff --git a/kiri-engine/Error/ErrorHandler.php b/kiri-engine/Error/ErrorHandler.php index 99090291..8af998fd 100644 --- a/kiri-engine/Error/ErrorHandler.php +++ b/kiri-engine/Error/ErrorHandler.php @@ -14,9 +14,8 @@ use ErrorException; use Exception; use Kiri; use Kiri\Abstracts\Component; -use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; -use Psr\Container\NotFoundExceptionInterface; +use Kiri\Di\Inject\Container; use ReflectionException; use Kiri\Events\OnSystemError; use Throwable; @@ -37,12 +36,10 @@ class ErrorHandler extends Component implements ErrorInterface /** - * @param ContainerInterface $container + * @var ContainerInterface */ - public function __construct(public ContainerInterface $container) - { - parent::__construct(); - } + #[Container(ContainerInterface::class)] + public ContainerInterface $container; /**