+12
-12
@@ -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
|
||||
|
||||
# 单元测试
|
||||
|
||||
Reference in New Issue
Block a user