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] #[Controller]
class GraphQLController class GraphQLController
{ {
/**
* @var Schema
*/
#[Inject] #[Inject]
protected $schema; protected Schema $schema;
#[PostMapping(path: "/graphql")] #[PostMapping(path: "/graphql")]
public function test(RequestInterface $request) public function test(RequestInterface $request)

View File

@ -237,11 +237,8 @@ use Hyperf\Metric\Contract\MetricFactoryInterface;
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
/**
* @var MetricFactoryInterface
*/
#[Inject] #[Inject]
private $metricFactory; private MetricFactoryInterface $metricFactory;
public function create(Order $order) public function create(Order $order)
{ {

View File

@ -15,7 +15,7 @@ composer require hyperf/async-queue
> 暂时只支持 `Redis Driver` 驱动。 > 暂时只支持 `Redis Driver` 驱动。
| 配置 | 类型 | 默认值 | 备注 | | 配置 | 类型 | 默认值 | 备注 |
|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:| | :--------------: | :-------: | :-----------------------------------------: | :-------------------------------------: |
| driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 无 | | driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 无 |
| channel | string | queue | 队列前缀 | | channel | string | queue | 队列前缀 |
| redis.pool | string | default | redis 连接池 | | redis.pool | string | default | redis 连接池 |
@ -376,11 +376,8 @@ use Hyperf\HttpServer\Annotation\AutoController;
#[AutoController] #[AutoController]
class QueueController extends AbstractController class QueueController extends AbstractController
{ {
/**
* @var QueueService
*/
#[Inject] #[Inject]
protected $service; protected QueueService $service;
/** /**
* 注解模式投递消息 * 注解模式投递消息
@ -427,7 +424,7 @@ php bin/hyperf.php queue:flush {queue_name} -Q {channel_name}
## 事件 ## 事件
| 事件名称 | 触发时机 | 备注 | | 事件名称 | 触发时机 | 备注 |
|:------------:|:-----------------------:|:----------------------------------------------------:| | :----------: | :---------------------: | :--------------------------------------------------: |
| BeforeHandle | 处理消息前触发 | | | BeforeHandle | 处理消息前触发 | |
| AfterHandle | 处理消息后触发 | | | AfterHandle | 处理消息后触发 | |
| FailedHandle | 处理消息失败后触发 | | | FailedHandle | 处理消息失败后触发 | |
@ -470,7 +467,7 @@ return [
任务执行流转流程主要包括以下几个队列: 任务执行流转流程主要包括以下几个队列:
| 队列名 | 备注 | | 队列名 | 备注 |
|:--------:|:-----------------------------------------:| | :------: | :---------------------------------------: |
| waiting | 等待消费的队列 | | waiting | 等待消费的队列 |
| reserved | 正在消费的队列 | | reserved | 正在消费的队列 |
| delayed | 延迟消费的队列 | | delayed | 延迟消费的队列 |

View File

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

View File

@ -27,11 +27,8 @@ use Hyperf\HttpServer\Contract\RequestInterface;
#[Controller] #[Controller]
class GraphQLController class GraphQLController
{ {
/**
* @var Schema
*/
#[Inject] #[Inject]
protected $schema; protected Schema $schema;
#[PostMapping(path: "/graphql")] #[PostMapping(path: "/graphql")]
public function test(RequestInterface $request) public function test(RequestInterface $request)

View File

@ -239,11 +239,8 @@ use Hyperf\Metric\Contract\MetricFactoryInterface;
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
/**
* @var MetricFactoryInterface
*/
#[Inject] #[Inject]
private $metricFactory; private MetricFactoryInterface $metricFactory;
public function create(Order $order) public function create(Order $order)
{ {

View File

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

View File

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

View File

@ -15,7 +15,7 @@ composer require hyperf/async-queue
> 暫時只支持 `Redis Driver` 驅動。 > 暫時只支持 `Redis Driver` 驅動。
| 配置 | 類型 | 默認值 | 備註 | | 配置 | 類型 | 默認值 | 備註 |
|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:| | :--------------: | :-------: | :-----------------------------------------: | :-------------------------------------: |
| driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 | | driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 |
| channel | string | queue | 隊列前綴 | | channel | string | queue | 隊列前綴 |
| redis.pool | string | default | redis 連接池 | | redis.pool | string | default | redis 連接池 |
@ -376,11 +376,8 @@ use Hyperf\HttpServer\Annotation\AutoController;
#[AutoController] #[AutoController]
class QueueController extends AbstractController class QueueController extends AbstractController
{ {
/**
* @var QueueService
*/
#[Inject] #[Inject]
protected $service; protected QueueService $service;
/** /**
* 註解模式投遞消息 * 註解模式投遞消息
@ -427,7 +424,7 @@ php bin/hyperf.php queue:flush {queue_name} -Q {channel_name}
## 事件 ## 事件
| 事件名稱 | 觸發時機 | 備註 | | 事件名稱 | 觸發時機 | 備註 |
|:------------:|:-----------------------:|:----------------------------------------------------:| | :----------: | :---------------------: | :--------------------------------------------------: |
| BeforeHandle | 處理消息前觸發 | | | BeforeHandle | 處理消息前觸發 | |
| AfterHandle | 處理消息後觸發 | | | AfterHandle | 處理消息後觸發 | |
| FailedHandle | 處理消息失敗後觸發 | | | FailedHandle | 處理消息失敗後觸發 | |
@ -470,7 +467,7 @@ return [
任務執行流轉流程主要包括以下幾個隊列: 任務執行流轉流程主要包括以下幾個隊列:
| 隊列名 | 備註 | | 隊列名 | 備註 |
|:--------:|:-----------------------------------------:| | :------: | :---------------------------------------: |
| waiting | 等待消費的隊列 | | waiting | 等待消費的隊列 |
| reserved | 正在消費的隊列 | | reserved | 正在消費的隊列 |
| delayed | 延遲消費的隊列 | | delayed | 延遲消費的隊列 |

View File

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

View File

@ -27,11 +27,8 @@ use Hyperf\HttpServer\Contract\RequestInterface;
#[Controller] #[Controller]
class GraphQLController class GraphQLController
{ {
/**
* @var Schema
*/
#[Inject] #[Inject]
protected $schema; protected Schema $schema;
#[PostMapping(path: "/graphql")] #[PostMapping(path: "/graphql")]
public function test(RequestInterface $request) public function test(RequestInterface $request)

View File

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

View File

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

View File

@ -15,7 +15,7 @@ composer require hyperf/async-queue
> 暫時只支援 `Redis Driver` 驅動。 > 暫時只支援 `Redis Driver` 驅動。
| 配置 | 型別 | 預設值 | 備註 | | 配置 | 型別 | 預設值 | 備註 |
|:----------------:|:---------:|:-------------------------------------------:|:---------------------------------------:| | :--------------: | :-------: | :-----------------------------------------: | :-------------------------------------: |
| driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 | | driver | string | Hyperf\AsyncQueue\Driver\RedisDriver::class | 無 |
| channel | string | queue | 佇列字首 | | channel | string | queue | 佇列字首 |
| redis.pool | string | default | redis 連線池 | | redis.pool | string | default | redis 連線池 |
@ -376,11 +376,8 @@ use Hyperf\HttpServer\Annotation\AutoController;
#[AutoController] #[AutoController]
class QueueController extends AbstractController class QueueController extends AbstractController
{ {
/**
* @var QueueService
*/
#[Inject] #[Inject]
protected $service; protected QueueService $service;
/** /**
* 註解模式投遞訊息 * 註解模式投遞訊息
@ -427,7 +424,7 @@ php bin/hyperf.php queue:flush {queue_name} -Q {channel_name}
## 事件 ## 事件
| 事件名稱 | 觸發時機 | 備註 | | 事件名稱 | 觸發時機 | 備註 |
|:------------:|:-----------------------:|:----------------------------------------------------:| | :----------: | :---------------------: | :----------------------------------------------------: |
| BeforeHandle | 處理訊息前觸發 | | | BeforeHandle | 處理訊息前觸發 | |
| AfterHandle | 處理訊息後觸發 | | | AfterHandle | 處理訊息後觸發 | |
| FailedHandle | 處理訊息失敗後觸發 | | | FailedHandle | 處理訊息失敗後觸發 | |
@ -470,7 +467,7 @@ return [
任務執行流轉流程主要包括以下幾個佇列: 任務執行流轉流程主要包括以下幾個佇列:
| 佇列名 | 備註 | | 佇列名 | 備註 |
|:--------:|:-----------------------------------------:| | :------: | :---------------------------------------: |
| waiting | 等待消費的佇列 | | waiting | 等待消費的佇列 |
| reserved | 正在消費的佇列 | | reserved | 正在消費的佇列 |
| delayed | 延遲消費的佇列 | | delayed | 延遲消費的佇列 |

View File

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

View File

@ -27,11 +27,8 @@ use Hyperf\HttpServer\Contract\RequestInterface;
#[Controller] #[Controller]
class GraphQLController class GraphQLController
{ {
/**
* @var Schema
*/
#[Inject] #[Inject]
protected $schema; protected Schema $schema;
#[PostMapping(path: "/graphql")] #[PostMapping(path: "/graphql")]
public function test(RequestInterface $request) public function test(RequestInterface $request)

View File

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

View File

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