diff --git a/.travis.yml b/.travis.yml index d2f17f8ff1..e4c99cb7d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,9 +26,12 @@ before_script: # - mysql -e 'create database egroupware' - rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini #- composer update --prefer-source $LOWEST_DEPS + - aptitude install myrepos + - mr --trust-all --stats up script: - - find . -name "*.php" | xargs -n1 php -l + #- find . -name "*.php" | xargs -n1 php -l + ./doc/php_syntax_check.sh #- ./vendor/bin/sabre-cs-fixer fix . --dry-run --diff cache: diff --git a/doc/php_syntax_check.sh b/doc/php_syntax_check.sh new file mode 100755 index 0000000000..7009d0c7a9 --- /dev/null +++ b/doc/php_syntax_check.sh @@ -0,0 +1,15 @@ +#!/bin/bash +################################################################################ +### Tool to check for PHP Syntax errors +### Usage: doc/php_syntax_check [file or directory, defaults to whole egrouware] +### Will output all PHP Fatal, Parse erros and also Deprecated incl. filename +### Exit-status: 0 on no error, but maybe Deprecated warnings, 1 on error +################################################################################ + +cd `dirname $0` +cd .. + +find ${@-.} -name '*.php' -exec php -l {} \; 2>&1 | \ + #grep -v 'No syntax errors detected in' | \ + grep '^PHP' | \ + perl -pe 'END { exit $status } $status=1 if /^PHP (Fatal|Parse error)/;'