phan: Don't hardcode 'php7.0' binary
authoraddshore <addshorewiki@gmail.com>
Wed, 11 Jan 2017 22:22:07 +0000 (14:22 -0800)
committeraddshore <addshorewiki@gmail.com>
Wed, 11 Jan 2017 22:27:58 +0000 (14:27 -0800)
This isn't available on all systems, e.g. Fedora just uses "php". People
with multiple versions of PHP installed can use an alternatives system
or something to make sure PHP 7 is used.

Change-Id: I03ef7c2d4223ade32f7a89c3a88706ae8c6e8156

tests/phan/bin/phan

index 61ad7da..ad06823 100755 (executable)
@@ -7,6 +7,12 @@ if ! which realpath > /dev/null; then
        }
 fi
 
+if hash php7.0 2>/dev/null; then
+       export PHP="php7.0"
+else
+       export PHP="php"
+fi
+
 # Note that this isn't loaded in via composer because then composer can
 # only be run with php7.0
 if [ ! -f "$PHAN" ]; then
@@ -19,7 +25,7 @@ if [ ! -f "$PHAN" ]; then
                exit 1
        fi
 else
-       export PHAN="php7.0 $PHAN"
+       export PHAN="$PHP $PHAN"
 fi
 
 if [ -z "$MW_INSTALL_PATH" ]; then