From 45cd23499bc83a275ac96d150ed8cceb9adc2423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=93=AD=E6=98=95?= <715557344@qq.com> Date: Tue, 19 Mar 2024 10:03:15 +0800 Subject: [PATCH] Format code --- .github/workflows/test.yml | 4 ++-- app/Constants/ErrorCode.php | 2 +- app/Constants/ErrorCodeInterface.php | 2 +- app/Exception/BusinessException.php | 2 +- app/Kernel/Functions.php | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8efb1cc..fdb3414 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: matrix: os: [ ubuntu-latest ] php-version: [ '8.1', '8.2', '8.3' ] - swoole-version: [ 'v5.0.3', 'v5.1.1', 'master' ] + swoole-version: [ 'v5.0.3', 'v5.1.2', 'master' ] exclude: - php-version: '8.3' swoole-version: 'v5.0.3' @@ -21,7 +21,7 @@ jobs: PHP_CS_FIXER_IGNORE_ENV: 1 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/app/Constants/ErrorCode.php b/app/Constants/ErrorCode.php index 76b59c8..c6c391c 100644 --- a/app/Constants/ErrorCode.php +++ b/app/Constants/ErrorCode.php @@ -25,7 +25,7 @@ enum ErrorCode: int implements ErrorCodeInterface */ case SERVER_ERROR = 500; - public function getMessage(array $translate = null): string + public function getMessage(?array $translate = null): string { $arguments = []; if ($translate) { diff --git a/app/Constants/ErrorCodeInterface.php b/app/Constants/ErrorCodeInterface.php index 4551c71..e6d296f 100644 --- a/app/Constants/ErrorCodeInterface.php +++ b/app/Constants/ErrorCodeInterface.php @@ -16,5 +16,5 @@ interface ErrorCodeInterface extends BackedEnum { - public function getMessage(array $translate = null): string; + public function getMessage(?array $translate = null): string; } diff --git a/app/Exception/BusinessException.php b/app/Exception/BusinessException.php index 3606225..f76c2ff 100644 --- a/app/Exception/BusinessException.php +++ b/app/Exception/BusinessException.php @@ -18,7 +18,7 @@ class BusinessException extends ServerException { - public function __construct(ErrorCodeInterface $code, string $message = null, Throwable $previous = null) + public function __construct(ErrorCodeInterface $code, ?string $message = null, ?Throwable $previous = null) { if (is_null($message)) { $message = $code->getMessage(); diff --git a/app/Kernel/Functions.php b/app/Kernel/Functions.php index aa005f5..11d3206 100644 --- a/app/Kernel/Functions.php +++ b/app/Kernel/Functions.php @@ -13,11 +13,12 @@ use Hyperf\AsyncQueue\JobInterface; use Hyperf\Context\ApplicationContext; use Hyperf\ExceptionHandler\Formatter\FormatterInterface; +use Psr\Container\ContainerInterface; if (! function_exists('di')) { /** * Finds an entry of the container by its identifier and returns it. - * @return mixed|\Psr\Container\ContainerInterface + * @return ContainerInterface|mixed */ function di(?string $id = null) {