better syntax check

This commit is contained in:
Alex Grintsvayg 2016-11-18 09:14:10 -05:00
parent 56e58f2a29
commit 744c9848d1

View file

@ -1,7 +1,18 @@
#!/bin/bash #!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ERRORS=0
for FILE in $(find "$DIR" -name '*.php'); do for FILE in $(find "$DIR" -name '*.php'); do
php7.0 -l $FILE CHECK=$(php7.0 -l $FILE | grep -v "^No syntax errors detected")
if [ -n "$CHECK" ]; then
echo "$CHECK"
ERRORS=1
fi
done done
if [ $ERRORS -eq 0 ]; then
echo "Syntax OK"
fi
exit $ERRORS