Release v3.1.46 (#7162)
Some checks failed
Mirror to CNB Repo / git-mirror (push) Has been cancelled
Mirror to Gitee Repo / git-mirror (push) Has been cancelled
Test for Hyperf Components / Test for Database (5.7, 8.1) (push) Has been cancelled
Test for Hyperf Components / Test for Database (5.7, 8.2) (push) Has been cancelled
Test for Hyperf Components / Test for Database (5.7, 8.3) (push) Has been cancelled
Test for Hyperf Components / Test for Database (8.0, 8.1) (push) Has been cancelled
Test for Hyperf Components / Test for Database (8.0, 8.2) (push) Has been cancelled
Test for Hyperf Components / Test for Database (8.0, 8.3) (push) Has been cancelled
Test for Hyperf Components / Test for Database (8.4, 8.1) (push) Has been cancelled
Test for Hyperf Components / Test for Database (8.4, 8.2) (push) Has been cancelled
Test for Hyperf Components / Test for Database (8.4, 8.3) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.1, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.1, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.1, ^3.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.2, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.2, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.2, ^3.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.3, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.3, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Filesystem (8.3, ^3.0) (push) Has been cancelled
Test for Hyperf Components / Test for Building PHAR (, 8.1) (push) Has been cancelled
Test for Hyperf Components / Test for Building PHAR (--no-dev, 8.1) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Container V1.0 ~ V2.0 (8.1, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Container V1.0 ~ V2.0 (8.1, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Container V1.0 ~ V2.0 (8.2, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Container V1.0 ~ V2.0 (8.2, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Container V1.0 ~ V2.0 (8.3, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Container V1.0 ~ V2.0 (8.3, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Http Message V1.0 ~ V2.0 (8.1, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Http Message V1.0 ~ V2.0 (8.1, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Http Message V1.0 ~ V2.0 (8.2, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Http Message V1.0 ~ V2.0 (8.2, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Http Message V1.0 ~ V2.0 (8.3, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Http Message V1.0 ~ V2.0 (8.3, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Log V1.0 ~ V3.0 (^1.0, 8.3) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Log V1.0 ~ V3.0 (^2.0, 8.1) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Log V1.0 ~ V3.0 (^2.0, 8.2) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Log V1.0 ~ V3.0 (^2.0, 8.3) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Log V1.0 ~ V3.0 (^3.0, 8.1) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Log V1.0 ~ V3.0 (^3.0, 8.2) (push) Has been cancelled
Test for Hyperf Components / Test for Psr Log V1.0 ~ V3.0 (^3.0, 8.3) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.1, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.1, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.1, ^3.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.2, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.2, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.2, ^3.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.3, ^1.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.3, ^2.0) (push) Has been cancelled
Test for Hyperf Components / Test for Psr SimpleCache V1.0 ~ V3.0 (8.3, ^3.0) (push) Has been cancelled
Test for Hyperf Components / Test for Redis Module (8.1, redis) (push) Has been cancelled
Test for Hyperf Components / Test for Redis Module (8.1, redis-5.3.7) (push) Has been cancelled
Test for Hyperf Components / Test for Redis Module (8.2, redis) (push) Has been cancelled
Test for Hyperf Components / Test for Redis Module (8.2, redis-5.3.7) (push) Has been cancelled
Test for Hyperf Components / Test for Redis Module (8.3, redis) (push) Has been cancelled
Test for Hyperf Components / Test for Redis Module (8.3, redis-5.3.7) (push) Has been cancelled
Test for Hyperf Components / Test for Symfony (8.1, ^6.0) (push) Has been cancelled
Test for Hyperf Components / Test for Symfony (8.2, ^6.0) (push) Has been cancelled
Test for Hyperf Components / Test for Symfony (8.2, ^7.0) (push) Has been cancelled
Test for Hyperf Components / Test for Symfony (8.3, ^6.0) (push) Has been cancelled
Test for Hyperf Components / Test for Symfony (8.3, ^7.0) (push) Has been cancelled
PHPUnit for Hyperf / PHP CS Fix on PHP${{ matrix.php }} ${{ matrix.swoole }} (ubuntu-latest, 8.1, swoole) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.1, master) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.1, v5.0.3) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.1, v5.1.4) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.1, v6.0.0-alpha) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.2, master) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.2, v5.0.3) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.2, v5.1.4) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.2, v6.0.0-alpha) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.3, master) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.3, v5.1.4) (push) Has been cancelled
PHPUnit for Hyperf / Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} (ubuntu-latest, 8.3, v6.0.0-alpha) (push) Has been cancelled

This commit is contained in:
李铭昕 2024-11-21 10:00:28 +08:00 committed by GitHub
parent f53c193862
commit d647cac206
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 75 additions and 28 deletions

View File

@ -1,4 +1,6 @@
# v3.1.46 - TBD
# v3.1.47 - TBD
# v3.1.46 - 2024-11-21
## Added

View File

@ -1,5 +1,14 @@
# Changelogs
# v3.1.46 - 2024-11-21
## Added
- [#7148](https://github.com/hyperf/hyperf/pull/7148) Added `exclude` rules for `hyperf/validation`.
- [#7150](https://github.com/hyperf/hyperf/pull/7150) Added missing methods (`accepted_if`, `ascii`, `date_equals`...) to validation messages.
- [#7151](https://github.com/hyperf/hyperf/pull/7151) Added hooks `beforeTestInCoroutine` and `afterTestInCoroutine` for `Hyperf\Testing\Concerns\RunTestsInCoroutine::runTestsInCoroutine()`.
- [#7156](https://github.com/hyperf/hyperf/pull/7156) Added method `Hyperf\Database\Schema\Blueprint::engine()`.
# v3.1.45 - 2024-11-14
## Added

View File

@ -1,5 +1,14 @@
# 版本更新记录
# v3.1.46 - 2024-11-21
## 新增
- [#7148](https://github.com/hyperf/hyperf/pull/7148) 为 `hyperf/validation` 增加 `exclude` 验证规则。
- [#7150](https://github.com/hyperf/hyperf/pull/7150) 为 `hyperf/validation` 增加部分验证规则,例如 `accepted_if`, `ascii`, `date_equals` 等。
- [#7151](https://github.com/hyperf/hyperf/pull/7151) 为 `Hyperf\Testing\Concerns\RunTestsInCoroutine::runTestsInCoroutine()` 增加钩子方法 `beforeTestInCoroutine``afterTestInCoroutine`
- [#7156](https://github.com/hyperf/hyperf/pull/7156) 新增方法 `Hyperf\Database\Schema\Blueprint::engine()`
# v3.1.45 - 2024-11-14
## 新增

View File

@ -63,7 +63,7 @@ enum ErrorCode: int
}
```
用户可以使用 `ErrorCode::getMessage(ErrorCode::SERVER_ERROR)` 来获取对应错误信息。
用户可以使用 `ErrorCode::SERVER_ERROR->getMessage()` 来获取对应错误信息。
### 定义异常类
@ -82,12 +82,18 @@ use Throwable;
class BusinessException extends ServerException
{
public function __construct(int $code = 0, string $message = null, Throwable $previous = null)
public function __construct(ErrorCode|int $code = 0, ?string $message = null, ?Throwable $previous = null)
{
if (is_null($message)) {
$message = ErrorCode::getMessage($code);
if ($code instanceof ErrorCode) {
$message = $code->getMessage();
} else {
$message = ErrorCode::getMessage($code);
}
}
$code = $code instanceof ErrorCode ? $code->value : $code;
parent::__construct($message, $code, $previous);
}
}
@ -118,7 +124,7 @@ class IndexController extends AbstractController
### 可变参数
在使用 `ErrorCode::getMessage(ErrorCode::SERVER_ERROR)` 来获取对应错误信息时,我们也可以传入可变参数,进行错误信息组合。比如以下情况
在使用 `ErrorCode::SERVER_ERROR->getMessage()` 来获取对应错误信息时,我们也可以传入可变参数,进行错误信息组合。比如以下情况
```php
<?php
@ -137,10 +143,7 @@ enum ErrorCode: int
case PARAMS_INVALID = 1000;
}
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, ['user_id']);
// 1.2 版本以下 可以使用以下方式,但会在 1.2 版本移除
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, 'user_id');
$message = ErrorCode::PARAMS_INVALID->getMessage(['user_id']);
```
### 国际化
@ -174,5 +177,5 @@ enum ErrorCode: int
case PARAMS_INVALID = 1000;
}
$message = ErrorCode::getMessage(ErrorCode::SERVER_ERROR, ['param' => 'user_id']);
$message = ErrorCode::SERVER_ERROR->getMessage(['param' => 'user_id']);
```

View File

@ -1,5 +1,14 @@
# 版本更新記錄
# v3.1.46 - 2024-11-21
## 新增
- [#7148](https://github.com/hyperf/hyperf/pull/7148) 為 `hyperf/validation` 增加 `exclude` 驗證規則。
- [#7150](https://github.com/hyperf/hyperf/pull/7150) 為 `hyperf/validation` 增加部分驗證規則,例如 `accepted_if`, `ascii`, `date_equals` 等。
- [#7151](https://github.com/hyperf/hyperf/pull/7151) 為 `Hyperf\Testing\Concerns\RunTestsInCoroutine::runTestsInCoroutine()` 增加鈎子方法 `beforeTestInCoroutine``afterTestInCoroutine`
- [#7156](https://github.com/hyperf/hyperf/pull/7156) 新增方法 `Hyperf\Database\Schema\Blueprint::engine()`
# v3.1.45 - 2024-11-14
## 新增

View File

@ -63,7 +63,7 @@ enum ErrorCode: int
}
```
用户可以使用 `ErrorCode::getMessage(ErrorCode::SERVER_ERROR)` 來獲取對應錯誤信息。
用户可以使用 `ErrorCode::SERVER_ERROR->getMessage()` 來獲取對應錯誤信息。
### 定義異常類
@ -82,12 +82,18 @@ use Throwable;
class BusinessException extends ServerException
{
public function __construct(int $code = 0, string $message = null, Throwable $previous = null)
public function __construct(ErrorCode|int $code = 0, ?string $message = null, ?Throwable $previous = null)
{
if (is_null($message)) {
$message = ErrorCode::getMessage($code);
if ($code instanceof ErrorCode) {
$message = $code->getMessage();
} else {
$message = ErrorCode::getMessage($code);
}
}
$code = $code instanceof ErrorCode ? $code->value : $code;
parent::__construct($message, $code, $previous);
}
}
@ -118,7 +124,7 @@ class IndexController extends AbstractController
### 可變參數
在使用 `ErrorCode::getMessage(ErrorCode::SERVER_ERROR)` 來獲取對應錯誤信息時,我們也可以傳入可變參數,進行錯誤信息組合。比如以下情況
在使用 `ErrorCode::SERVER_ERROR->getMessage()` 來獲取對應錯誤信息時,我們也可以傳入可變參數,進行錯誤信息組合。比如以下情況
```php
<?php
@ -137,10 +143,7 @@ enum ErrorCode: int
case PARAMS_INVALID = 1000;
}
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, ['user_id']);
// 1.2 版本以下 可以使用以下方式,但會在 1.2 版本移除
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, 'user_id');
$message = ErrorCode::PARAMS_INVALID->getMessage(['user_id']);
```
### 國際化
@ -174,5 +177,5 @@ enum ErrorCode: int
case PARAMS_INVALID = 1000;
}
$message = ErrorCode::getMessage(ErrorCode::SERVER_ERROR, ['param' => 'user_id']);
$message = ErrorCode::SERVER_ERROR->getMessage(['param' => 'user_id']);
```

View File

@ -1,5 +1,14 @@
# 版本更新記錄
# v3.1.46 - 2024-11-21
## 新增
- [#7148](https://github.com/hyperf/hyperf/pull/7148) 為 `hyperf/validation` 增加 `exclude` 驗證規則。
- [#7150](https://github.com/hyperf/hyperf/pull/7150) 為 `hyperf/validation` 增加部分驗證規則,例如 `accepted_if`, `ascii`, `date_equals` 等。
- [#7151](https://github.com/hyperf/hyperf/pull/7151) 為 `Hyperf\Testing\Concerns\RunTestsInCoroutine::runTestsInCoroutine()` 增加鉤子方法 `beforeTestInCoroutine``afterTestInCoroutine`
- [#7156](https://github.com/hyperf/hyperf/pull/7156) 新增方法 `Hyperf\Database\Schema\Blueprint::engine()`
# v3.1.45 - 2024-11-14
## 新增

View File

@ -63,7 +63,7 @@ enum ErrorCode: int
}
```
使用者可以使用 `ErrorCode::getMessage(ErrorCode::SERVER_ERROR)` 來獲取對應錯誤資訊。
使用者可以使用 `ErrorCode::SERVER_ERROR->getMessage()` 來獲取對應錯誤資訊。
### 定義異常類
@ -82,12 +82,18 @@ use Throwable;
class BusinessException extends ServerException
{
public function __construct(int $code = 0, string $message = null, Throwable $previous = null)
public function __construct(ErrorCode|int $code = 0, ?string $message = null, ?Throwable $previous = null)
{
if (is_null($message)) {
$message = ErrorCode::getMessage($code);
if ($code instanceof ErrorCode) {
$message = $code->getMessage();
} else {
$message = ErrorCode::getMessage($code);
}
}
$code = $code instanceof ErrorCode ? $code->value : $code;
parent::__construct($message, $code, $previous);
}
}
@ -118,7 +124,7 @@ class IndexController extends AbstractController
### 可變引數
在使用 `ErrorCode::getMessage(ErrorCode::SERVER_ERROR)` 來獲取對應錯誤資訊時,我們也可以傳入可變引數,進行錯誤資訊組合。比如以下情況
在使用 `ErrorCode::SERVER_ERROR->getMessage()` 來獲取對應錯誤資訊時,我們也可以傳入可變引數,進行錯誤資訊組合。比如以下情況
```php
<?php
@ -137,10 +143,7 @@ enum ErrorCode: int
case PARAMS_INVALID = 1000;
}
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, ['user_id']);
// 1.2 版本以下 可以使用以下方式,但會在 1.2 版本移除
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, 'user_id');
$message = ErrorCode::PARAMS_INVALID->getMessage(['user_id']);
```
### 國際化
@ -174,5 +177,5 @@ enum ErrorCode: int
case PARAMS_INVALID = 1000;
}
$message = ErrorCode::getMessage(ErrorCode::SERVER_ERROR, ['param' => 'user_id']);
$message = ErrorCode::SERVER_ERROR->getMessage(['param' => 'user_id']);
```