Upgrade Docs: Remove Redundant @var Annotations for Injected Properties (#7134)

This commit is contained in:
guandeng 2024-10-31 09:50:31 +08:00 committed by GitHub
parent 40894ce6ee
commit 7f6b899939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 35 additions and 89 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -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 | 延迟消费的队列 |

View File

@ -141,11 +141,8 @@ use App\Event\UserRegistered;
class UserService
{
/**
* @var EventDispatcherInterface
*/
#[Inject]
private $eventDispatcher;
private EventDispatcherInterface $eventDispatcher;
public function register()
{

View File

@ -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)

View File

@ -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)
{

View File

@ -81,11 +81,8 @@ use Hyperf\Di\Annotation\Inject;
trait TestTrait
{
/**
* @var ResponseInterface
*/
#[Inject]
protected $response;
protected ResponseInterface $response;
}
```

View File

@ -230,11 +230,8 @@ use Hyperf\WebSocketServer\Sender;
#[AutoController]
class ServerController
{
/**
* @var Sender
*/
#[Inject]
protected $sender;
protected Sender $sender;
public function close(int $fd)
{

View File

@ -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 | 延遲消費的隊列 |

View File

@ -141,11 +141,8 @@ use App\Event\UserRegistered;
class UserService
{
/**
* @var EventDispatcherInterface
*/
#[Inject]
private $eventDispatcher;
private EventDispatcherInterface $eventDispatcher;
public function register()
{

View File

@ -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)

View File

@ -81,11 +81,8 @@ use Hyperf\Di\Annotation\Inject;
trait TestTrait
{
/**
* @var ResponseInterface
*/
#[Inject]
protected $response;
protected ResponseInterface $response;
}
```

View File

@ -230,11 +230,8 @@ use Hyperf\WebSocketServer\Sender;
#[AutoController]
class ServerController
{
/**
* @var Sender
*/
#[Inject]
protected $sender;
protected Sender $sender;
public function close(int $fd)
{

View File

@ -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 | 延遲消費的佇列 |

View File

@ -141,11 +141,8 @@ use App\Event\UserRegistered;
class UserService
{
/**
* @var EventDispatcherInterface
*/
#[Inject]
private $eventDispatcher;
private EventDispatcherInterface $eventDispatcher;
public function register()
{

View File

@ -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)

View File

@ -81,11 +81,8 @@ use Hyperf\Di\Annotation\Inject;
trait TestTrait
{
/**
* @var ResponseInterface
*/
#[Inject]
protected $response;
protected ResponseInterface $response;
}
```

View File

@ -230,11 +230,8 @@ use Hyperf\WebSocketServer\Sender;
#[AutoController]
class ServerController
{
/**
* @var Sender
*/
#[Inject]
protected $sender;
protected Sender $sender;
public function close(int $fd)
{