From 7f6b89993965e9f4d8379c6cbdf39c3f1c1b9dfa Mon Sep 17 00:00:00 2001 From: guandeng Date: Thu, 31 Oct 2024 09:50:31 +0800 Subject: [PATCH] Upgrade Docs: Remove Redundant @var Annotations for Injected Properties (#7134) --- docs/en/graphql.md | 5 +---- docs/en/metric.md | 5 +---- docs/zh-cn/async-queue.md | 13 +++++-------- docs/zh-cn/event.md | 5 +---- docs/zh-cn/graphql.md | 5 +---- docs/zh-cn/metric.md | 5 +---- docs/zh-cn/quick-start/questions.md | 5 +---- docs/zh-cn/websocket-server.md | 5 +---- docs/zh-hk/async-queue.md | 13 +++++-------- docs/zh-hk/event.md | 5 +---- docs/zh-hk/graphql.md | 5 +---- docs/zh-hk/quick-start/questions.md | 5 +---- docs/zh-hk/websocket-server.md | 5 +---- docs/zh-tw/async-queue.md | 23 ++++++++++------------- docs/zh-tw/event.md | 5 +---- docs/zh-tw/graphql.md | 5 +---- docs/zh-tw/quick-start/questions.md | 5 +---- docs/zh-tw/websocket-server.md | 5 +---- 18 files changed, 35 insertions(+), 89 deletions(-) diff --git a/docs/en/graphql.md b/docs/en/graphql.md index 060c065e1..0056461fd 100644 --- a/docs/en/graphql.md +++ b/docs/en/graphql.md @@ -27,11 +27,8 @@ use Hyperf\HttpServer\Contract\RequestInterface; #[Controller] class GraphQLController { - /** - * @var Schema - */ #[Inject] - protected $schema; + protected Schema $schema; #[PostMapping(path: "/graphql")] public function test(RequestInterface $request) diff --git a/docs/en/metric.md b/docs/en/metric.md index 9fa5a7c8e..53a7ed568 100644 --- a/docs/en/metric.md +++ b/docs/en/metric.md @@ -237,11 +237,8 @@ use Hyperf\Metric\Contract\MetricFactoryInterface; class IndexController extends AbstractController { - /** - * @var MetricFactoryInterface - */ #[Inject] - private $metricFactory; + private MetricFactoryInterface $metricFactory; public function create(Order $order) { diff --git a/docs/zh-cn/async-queue.md b/docs/zh-cn/async-queue.md index 6e737f469..1c238ba44 100644 --- a/docs/zh-cn/async-queue.md +++ b/docs/zh-cn/async-queue.md @@ -15,10 +15,10 @@ composer require hyperf/async-queue > 暂时只支持 `Redis Driver` 驱动。 | 配置 | 类型 | 默认值 | 备注 | -|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:| +| :--------------: | :-------: | :-----------------------------------------: | :-------------------------------------: | | driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 无 | | channel | string | queue | 队列前缀 | -| redis.pool | string | default | redis 连接池 | +| redis.pool | string | default | redis 连接池 | | timeout | int | 2 | pop 消息的超时时间 | | retry_seconds | int,array | 5 | 失败后重新尝试间隔 | | handle_timeout | int | 10 | 消息处理超时时间 | @@ -376,11 +376,8 @@ use Hyperf\HttpServer\Annotation\AutoController; #[AutoController] class QueueController extends AbstractController { - /** - * @var QueueService - */ #[Inject] - protected $service; + protected QueueService $service; /** * 注解模式投递消息 @@ -427,7 +424,7 @@ php bin/hyperf.php queue:flush {queue_name} -Q {channel_name} ## 事件 | 事件名称 | 触发时机 | 备注 | -|:------------:|:-----------------------:|:----------------------------------------------------:| +| :----------: | :---------------------: | :--------------------------------------------------: | | BeforeHandle | 处理消息前触发 | | | AfterHandle | 处理消息后触发 | | | FailedHandle | 处理消息失败后触发 | | @@ -470,7 +467,7 @@ return [ 任务执行流转流程主要包括以下几个队列: | 队列名 | 备注 | -|:--------:|:-----------------------------------------:| +| :------: | :---------------------------------------: | | waiting | 等待消费的队列 | | reserved | 正在消费的队列 | | delayed | 延迟消费的队列 | diff --git a/docs/zh-cn/event.md b/docs/zh-cn/event.md index e5b0bf489..518e2650d 100644 --- a/docs/zh-cn/event.md +++ b/docs/zh-cn/event.md @@ -141,11 +141,8 @@ use App\Event\UserRegistered; class UserService { - /** - * @var EventDispatcherInterface - */ #[Inject] - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function register() { diff --git a/docs/zh-cn/graphql.md b/docs/zh-cn/graphql.md index bb6541056..d488ddeea 100644 --- a/docs/zh-cn/graphql.md +++ b/docs/zh-cn/graphql.md @@ -27,11 +27,8 @@ use Hyperf\HttpServer\Contract\RequestInterface; #[Controller] class GraphQLController { - /** - * @var Schema - */ #[Inject] - protected $schema; + protected Schema $schema; #[PostMapping(path: "/graphql")] public function test(RequestInterface $request) diff --git a/docs/zh-cn/metric.md b/docs/zh-cn/metric.md index 1e2c502b9..2b1698b8d 100644 --- a/docs/zh-cn/metric.md +++ b/docs/zh-cn/metric.md @@ -239,11 +239,8 @@ use Hyperf\Metric\Contract\MetricFactoryInterface; class IndexController extends AbstractController { - /** - * @var MetricFactoryInterface - */ #[Inject] - private $metricFactory; + private MetricFactoryInterface $metricFactory; public function create(Order $order) { diff --git a/docs/zh-cn/quick-start/questions.md b/docs/zh-cn/quick-start/questions.md index 25fee0365..a020f863e 100644 --- a/docs/zh-cn/quick-start/questions.md +++ b/docs/zh-cn/quick-start/questions.md @@ -81,11 +81,8 @@ use Hyperf\Di\Annotation\Inject; trait TestTrait { - /** - * @var ResponseInterface - */ #[Inject] - protected $response; + protected ResponseInterface $response; } ``` diff --git a/docs/zh-cn/websocket-server.md b/docs/zh-cn/websocket-server.md index 7fcb884d3..917056b46 100644 --- a/docs/zh-cn/websocket-server.md +++ b/docs/zh-cn/websocket-server.md @@ -230,11 +230,8 @@ use Hyperf\WebSocketServer\Sender; #[AutoController] class ServerController { - /** - * @var Sender - */ #[Inject] - protected $sender; + protected Sender $sender; public function close(int $fd) { diff --git a/docs/zh-hk/async-queue.md b/docs/zh-hk/async-queue.md index 1ffca35fd..1b0bdfb6d 100644 --- a/docs/zh-hk/async-queue.md +++ b/docs/zh-hk/async-queue.md @@ -15,10 +15,10 @@ composer require hyperf/async-queue > 暫時只支持 `Redis Driver` 驅動。 | 配置 | 類型 | 默認值 | 備註 | -|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:| +| :--------------: | :-------: | :-----------------------------------------: | :-------------------------------------: | | driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 | | channel | string | queue | 隊列前綴 | -| redis.pool | string | default | redis 連接池 | +| redis.pool | string | default | redis 連接池 | | timeout | int | 2 | pop 消息的超時時間 | | retry_seconds | int,array | 5 | 失敗後重新嘗試間隔 | | handle_timeout | int | 10 | 消息處理超時時間 | @@ -376,11 +376,8 @@ use Hyperf\HttpServer\Annotation\AutoController; #[AutoController] class QueueController extends AbstractController { - /** - * @var QueueService - */ #[Inject] - protected $service; + protected QueueService $service; /** * 註解模式投遞消息 @@ -427,7 +424,7 @@ php bin/hyperf.php queue:flush {queue_name} -Q {channel_name} ## 事件 | 事件名稱 | 觸發時機 | 備註 | -|:------------:|:-----------------------:|:----------------------------------------------------:| +| :----------: | :---------------------: | :--------------------------------------------------: | | BeforeHandle | 處理消息前觸發 | | | AfterHandle | 處理消息後觸發 | | | FailedHandle | 處理消息失敗後觸發 | | @@ -470,7 +467,7 @@ return [ 任務執行流轉流程主要包括以下幾個隊列: | 隊列名 | 備註 | -|:--------:|:-----------------------------------------:| +| :------: | :---------------------------------------: | | waiting | 等待消費的隊列 | | reserved | 正在消費的隊列 | | delayed | 延遲消費的隊列 | diff --git a/docs/zh-hk/event.md b/docs/zh-hk/event.md index 4c3add0f7..bbcaa6a0e 100644 --- a/docs/zh-hk/event.md +++ b/docs/zh-hk/event.md @@ -141,11 +141,8 @@ use App\Event\UserRegistered; class UserService { - /** - * @var EventDispatcherInterface - */ #[Inject] - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function register() { diff --git a/docs/zh-hk/graphql.md b/docs/zh-hk/graphql.md index 1fbe02d38..34be8fadb 100644 --- a/docs/zh-hk/graphql.md +++ b/docs/zh-hk/graphql.md @@ -27,11 +27,8 @@ use Hyperf\HttpServer\Contract\RequestInterface; #[Controller] class GraphQLController { - /** - * @var Schema - */ #[Inject] - protected $schema; + protected Schema $schema; #[PostMapping(path: "/graphql")] public function test(RequestInterface $request) diff --git a/docs/zh-hk/quick-start/questions.md b/docs/zh-hk/quick-start/questions.md index 3e545f49a..294da9bfb 100644 --- a/docs/zh-hk/quick-start/questions.md +++ b/docs/zh-hk/quick-start/questions.md @@ -81,11 +81,8 @@ use Hyperf\Di\Annotation\Inject; trait TestTrait { - /** - * @var ResponseInterface - */ #[Inject] - protected $response; + protected ResponseInterface $response; } ``` diff --git a/docs/zh-hk/websocket-server.md b/docs/zh-hk/websocket-server.md index c457a6901..3c25428c6 100644 --- a/docs/zh-hk/websocket-server.md +++ b/docs/zh-hk/websocket-server.md @@ -230,11 +230,8 @@ use Hyperf\WebSocketServer\Sender; #[AutoController] class ServerController { - /** - * @var Sender - */ #[Inject] - protected $sender; + protected Sender $sender; public function close(int $fd) { diff --git a/docs/zh-tw/async-queue.md b/docs/zh-tw/async-queue.md index b432fabeb..ded3ba77e 100644 --- a/docs/zh-tw/async-queue.md +++ b/docs/zh-tw/async-queue.md @@ -15,10 +15,10 @@ composer require hyperf/async-queue > 暫時只支援 `Redis Driver` 驅動。 | 配置 | 型別 | 預設值 | 備註 | -|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:| +| :--------------: | :-------: | :-----------------------------------------: | :-------------------------------------: | | driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 | | channel | string | queue | 佇列字首 | -| redis.pool | string | default | redis 連線池 | +| redis.pool | string | default | redis 連線池 | | timeout | int | 2 | pop 訊息的超時時間 | | retry_seconds | int,array | 5 | 失敗後重新嘗試間隔 | | handle_timeout | int | 10 | 訊息處理超時時間 | @@ -376,11 +376,8 @@ use Hyperf\HttpServer\Annotation\AutoController; #[AutoController] class QueueController extends AbstractController { - /** - * @var QueueService - */ #[Inject] - protected $service; + protected QueueService $service; /** * 註解模式投遞訊息 @@ -426,12 +423,12 @@ php bin/hyperf.php queue:flush {queue_name} -Q {channel_name} ## 事件 -| 事件名稱 | 觸發時機 | 備註 | -|:------------:|:-----------------------:|:----------------------------------------------------:| -| BeforeHandle | 處理訊息前觸發 | | -| AfterHandle | 處理訊息後觸發 | | -| FailedHandle | 處理訊息失敗後觸發 | | -| RetryHandle | 重試處理訊息前觸發 | | +| 事件名稱 | 觸發時機 | 備註 | +| :----------: | :---------------------: | :----------------------------------------------------: | +| BeforeHandle | 處理訊息前觸發 | | +| AfterHandle | 處理訊息後觸發 | | +| FailedHandle | 處理訊息失敗後觸發 | | +| RetryHandle | 重試處理訊息前觸發 | | | QueueLength | 每處理 500 個訊息後觸發 | 使用者可以監聽此事件,判斷失敗或超時佇列是否有訊息積壓 | ### QueueLengthListener @@ -470,7 +467,7 @@ return [ 任務執行流轉流程主要包括以下幾個佇列: | 佇列名 | 備註 | -|:--------:|:-----------------------------------------:| +| :------: | :---------------------------------------: | | waiting | 等待消費的佇列 | | reserved | 正在消費的佇列 | | delayed | 延遲消費的佇列 | diff --git a/docs/zh-tw/event.md b/docs/zh-tw/event.md index 77d54b5d6..d55c756ad 100644 --- a/docs/zh-tw/event.md +++ b/docs/zh-tw/event.md @@ -141,11 +141,8 @@ use App\Event\UserRegistered; class UserService { - /** - * @var EventDispatcherInterface - */ #[Inject] - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function register() { diff --git a/docs/zh-tw/graphql.md b/docs/zh-tw/graphql.md index c524cf61c..fb003d12f 100644 --- a/docs/zh-tw/graphql.md +++ b/docs/zh-tw/graphql.md @@ -27,11 +27,8 @@ use Hyperf\HttpServer\Contract\RequestInterface; #[Controller] class GraphQLController { - /** - * @var Schema - */ #[Inject] - protected $schema; + protected Schema $schema; #[PostMapping(path: "/graphql")] public function test(RequestInterface $request) diff --git a/docs/zh-tw/quick-start/questions.md b/docs/zh-tw/quick-start/questions.md index b4ddde27a..37bbac2d0 100644 --- a/docs/zh-tw/quick-start/questions.md +++ b/docs/zh-tw/quick-start/questions.md @@ -81,11 +81,8 @@ use Hyperf\Di\Annotation\Inject; trait TestTrait { - /** - * @var ResponseInterface - */ #[Inject] - protected $response; + protected ResponseInterface $response; } ``` diff --git a/docs/zh-tw/websocket-server.md b/docs/zh-tw/websocket-server.md index 874a70617..fbc2e9f2c 100644 --- a/docs/zh-tw/websocket-server.md +++ b/docs/zh-tw/websocket-server.md @@ -230,11 +230,8 @@ use Hyperf\WebSocketServer\Sender; #[AutoController] class ServerController { - /** - * @var Sender - */ #[Inject] - protected $sender; + protected Sender $sender; public function close(int $fd) {