fix: 改进 PHP 语法检查输出
Test CI / 快速测试 (push) Failing after 2s

This commit is contained in:
2026-03-01 23:47:29 +08:00
parent 4e964c8a18
commit bbcd2eb80f
+12 -12
View File
@@ -23,19 +23,19 @@ jobs:
- name: PHP 语法检查 - name: PHP 语法检查
run: | run: |
echo "📝 PHP 语法检查..." echo "📝 PHP 语法检查..."
errors=0
for file in $(find . -name "*.php" -not -path "./vendor/*"); do # 检查所有 PHP 文件(排除 vendor),保存完整输出
if ! php -l "$file" > /dev/null 2>&1; then {
echo "❌ 语法错误: $file" find . -name "*.php" -not -path "./vendor/*" -exec sh -c 'php -l "$1" 2>&1 || true' _ {} \;
php -l "$file" || true } > /tmp/lint_output.txt
errors=$((errors + 1))
fi # 检查是否有错误
done if grep -q "^Parse error\|^Fatal error\|^Syntax error" /tmp/lint_output.txt; then
if [ $errors -eq 0 ]; then echo "❌ PHP 语法错误:"
echo "✅ 所有 PHP 文件语法正确" cat /tmp/lint_output.txt
else
echo "❌ 发现 $errors 个语法错误"
exit 1 exit 1
else
echo "✅ 所有 PHP 文件语法正确"
fi fi
# 单元测试 # 单元测试