From bbcd2eb80f56355113c82798157747a655328365 Mon Sep 17 00:00:00 2001 From: starmen1265 Date: Sun, 1 Mar 2026 23:47:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B9=E8=BF=9B=20PHP=20=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E6=A3=80=E6=9F=A5=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e3db515..83c24b6 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -23,19 +23,19 @@ jobs: - name: PHP 语法检查 run: | echo "📝 PHP 语法检查..." - errors=0 - for file in $(find . -name "*.php" -not -path "./vendor/*"); do - if ! php -l "$file" > /dev/null 2>&1; then - echo "❌ 语法错误: $file" - php -l "$file" || true - errors=$((errors + 1)) - fi - done - if [ $errors -eq 0 ]; then - echo "✅ 所有 PHP 文件语法正确" - else - echo "❌ 发现 $errors 个语法错误" + + # 检查所有 PHP 文件(排除 vendor),保存完整输出 + { + find . -name "*.php" -not -path "./vendor/*" -exec sh -c 'php -l "$1" 2>&1 || true' _ {} \; + } > /tmp/lint_output.txt + + # 检查是否有错误 + if grep -q "^Parse error\|^Fatal error\|^Syntax error" /tmp/lint_output.txt; then + echo "❌ PHP 语法错误:" + cat /tmp/lint_output.txt exit 1 + else + echo "✅ 所有 PHP 文件语法正确" fi # 单元测试