From 93b56c8acdea1d16f1ba24d25046ab78cfcc5e56 Mon Sep 17 00:00:00 2001 From: Yurun Date: Tue, 31 Oct 2023 13:01:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../queue/src/Process/SwooleQueueConsumerProcess.php | 2 +- .../example/MainServer/Controller/IndexController.php | 7 +++++-- src/Validate/Annotation/Scene.php | 2 +- tests/unit/Component/Inject/Classes/TestArg.php | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Components/queue/src/Process/SwooleQueueConsumerProcess.php b/src/Components/queue/src/Process/SwooleQueueConsumerProcess.php index ef6bbd33aa..a2ec9edf34 100644 --- a/src/Components/queue/src/Process/SwooleQueueConsumerProcess.php +++ b/src/Components/queue/src/Process/SwooleQueueConsumerProcess.php @@ -21,7 +21,7 @@ /** * Swoole 队列消费进程. */ - #[Process(name: 'QueueConsumer', unique: true, co: fasle)] + #[Process(name: 'QueueConsumer', unique: true, co: false)] class SwooleQueueConsumerProcess extends BaseProcess { #[Inject(name: 'imiQueue')] diff --git a/src/Components/smarty/example/MainServer/Controller/IndexController.php b/src/Components/smarty/example/MainServer/Controller/IndexController.php index f8e8758381..ae41f480f7 100644 --- a/src/Components/smarty/example/MainServer/Controller/IndexController.php +++ b/src/Components/smarty/example/MainServer/Controller/IndexController.php @@ -8,6 +8,7 @@ use Imi\Server\Http\Route\Annotation\Action; use Imi\Server\Http\Route\Annotation\Controller; use Imi\Server\Http\Route\Annotation\Route; +use Imi\Server\View\Annotation\HtmlView; use Imi\Server\View\Annotation\View; #[Controller(prefix: '/')] @@ -18,7 +19,8 @@ class IndexController extends HttpController */ #[Action] #[Route(url: '/')] - #[View(renderType: 'html', template: 'index')] + #[View(renderType: 'html')] + #[HtmlView(template: 'index')] public function index() { $datetime = date('Y-m-d H:i:s'); @@ -32,7 +34,8 @@ public function index() * @return mixed */ #[Action] - #[View(renderType: 'html', template: 'test')] + #[View(renderType: 'html')] + #[HtmlView(template: 'test')] public function test() { return [ diff --git a/src/Validate/Annotation/Scene.php b/src/Validate/Annotation/Scene.php index cdf9b6a6f6..d4eea31a00 100644 --- a/src/Validate/Annotation/Scene.php +++ b/src/Validate/Annotation/Scene.php @@ -17,7 +17,7 @@ * @property string $name 场景名称 * @property array $fields 需要验证的字段名列表 */ -#[\Attribute(\Attribute::TARGET_CLASS)] +#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] class Scene extends Base { public function __construct(?array $__data = null, string $name = '', array $fields = []) diff --git a/tests/unit/Component/Inject/Classes/TestArg.php b/tests/unit/Component/Inject/Classes/TestArg.php index 10c3793f2d..2af48647d1 100644 --- a/tests/unit/Component/Inject/Classes/TestArg.php +++ b/tests/unit/Component/Inject/Classes/TestArg.php @@ -17,7 +17,7 @@ class TestArg * @param string $phpVersion */ #[FilterArg(name: 'id', filter: 'intval')] - #[InjectArg(name: 'phpVersion', value: '8.1.24')] + #[InjectArg(name: 'phpVersion', value: \PHP_VERSION)] public function test($id, $phpVersion = null): void { Assert::assertTrue(\is_int($id));