From e4343cafcc83359c8c7b460563867ec8dc84b0f9 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 7 May 2018 19:46:16 +0200 Subject: [PATCH] Add rudimentary PHP syntax checking (#5) --- .travis.yml | 14 ++++++++++++++ bin/check-syntax.sh | 15 +++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .travis.yml create mode 100755 bin/check-syntax.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..4587f1e7 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: php +php: +- 5.4 +- 5.5 +- 5.6 +- 7.0 +- 7.1 +- 7.2 +- hhvm +matrix: + allow_failures: + - php: hhvm +script: +- bin/check-syntax.sh diff --git a/bin/check-syntax.sh b/bin/check-syntax.sh new file mode 100755 index 00000000..a9a84723 --- /dev/null +++ b/bin/check-syntax.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +PHP='/usr/bin/env php' +RETURN=0 + +# check PHP files +for FILE in `find config-templates hooks lib templates www -name "*.php"`; do + $PHP -l $FILE > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Syntax check failed for ${FILE}" + RETURN=`expr ${RETURN} + 1` + fi +done + +exit $RETURN