lbry.com/check_syntax.sh
2016-11-18 09:14:10 -05:00

18 lines
322 B
Bash
Executable file

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