fix: 使用 set -e 让语法错误直接退出并显示详情
Test CI / 快速测试 (push) Failing after 2s

This commit is contained in:
2026-03-01 23:51:38 +08:00
parent bbcd2eb80f
commit b6fffab885
+3 -14
View File
@@ -22,21 +22,10 @@ jobs:
- name: PHP 语法检查
run: |
set -e
echo "📝 PHP 语法检查..."
# 检查所有 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
find . -name "*.php" -not -path "./vendor/*" -print0 | xargs -0 -n1 php -l
echo "✅ 所有 PHP 文件语法正确"
# 单元测试
test: