From f358cfd9ed153ad526ddba7bfea3588eec4885c2 Mon Sep 17 00:00:00 2001 From: Yurun Date: Thu, 2 May 2024 08:58:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=20(#696)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复 Swoole 测试的 Event::wait() 警告报错 (#693) * 修复 Swoole 测试的 Event::wait() 警告报错 * 修复测试 * 修复测试 * 修复测试 * 修复测试 * 修复测试 --- .github/workflows/ci.yml | 4 ++++ src/Components/grpc/src/Middleware/ActionMiddleware.php | 4 ++++ src/Components/swoole/tests/unit/Component/config/config.php | 5 +++-- src/Server/Http/Middleware/ActionMiddleware.php | 4 ++++ src/Util/DocBlock.php | 3 ++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08f3fb8914..2792781342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -352,6 +352,10 @@ jobs: uses: shogo82148/actions-setup-redis@v1 with: redis-version: "6.x" + # MacOS Arm64 下需要下面的修复,否则无法编译成功 + - name: Fix include + run: | + sudo ln -s $(brew --prefix pcre2)/include/pcre2.h /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ - name: Get Openssl Dir id: opecssl-dir run: echo "path=$(brew --prefix openssl@1.1)" >> $GITHUB_OUTPUT diff --git a/src/Components/grpc/src/Middleware/ActionMiddleware.php b/src/Components/grpc/src/Middleware/ActionMiddleware.php index 4266e1d78a..b6e6265144 100644 --- a/src/Components/grpc/src/Middleware/ActionMiddleware.php +++ b/src/Components/grpc/src/Middleware/ActionMiddleware.php @@ -218,6 +218,10 @@ private function prepareActionParams(Request $request, RouteResult $routeResult) $headers[$name] = implode(', ', $values); } } + else + { + $allData = []; + } /** @var ActionMethodItem[] $actionMethodCache */ foreach ($actionMethodCache as $actionMethodCacheItem) diff --git a/src/Components/swoole/tests/unit/Component/config/config.php b/src/Components/swoole/tests/unit/Component/config/config.php index 7e2aaabfc1..07837ab1d6 100644 --- a/src/Components/swoole/tests/unit/Component/config/config.php +++ b/src/Components/swoole/tests/unit/Component/config/config.php @@ -16,8 +16,9 @@ 'Imi\Swoole\Test\Component\Async', 'Imi\Swoole\Test\Component\Pool', ], - // 'ignoreNamespace' => [ - // ], + 'ignorePaths' => [ + \dirname(__DIR__) . \DIRECTORY_SEPARATOR . 'test.php', + ], // 组件命名空间 'components' => [ diff --git a/src/Server/Http/Middleware/ActionMiddleware.php b/src/Server/Http/Middleware/ActionMiddleware.php index 85ba1446dc..26584a72c2 100644 --- a/src/Server/Http/Middleware/ActionMiddleware.php +++ b/src/Server/Http/Middleware/ActionMiddleware.php @@ -204,6 +204,10 @@ private function prepareActionParams(Request $request, RouteResult $routeResult) $headers[$name] = implode(', ', $values); } } + else + { + $allData = []; + } /** @var ActionMethodItem[] $actionMethodCache */ foreach ($actionMethodCache as $actionMethodCacheItem) diff --git a/src/Util/DocBlock.php b/src/Util/DocBlock.php index e454bf7a21..295190c9c9 100644 --- a/src/Util/DocBlock.php +++ b/src/Util/DocBlock.php @@ -19,7 +19,8 @@ public static function getFactory(): DocBlockFactory { if (null === self::$factory) { - self::$factory = DocBlockFactory::createInstance(); + // @phpstan-ignore-next-line + return self::$factory = DocBlockFactory::createInstance(); } return self::$factory;