}
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
- echo "The environment variable PHAN must point to the 'phan' file"
- echo "in a checkout of https://github.com/etsy/phan.git"
- exit 1
+ # If no PHAN is specified then try to get location from PATH
+ export PHAN="$(which phan)"
+ if [ ! -f "$PHAN" ]; then
+ echo "The environment variable PHAN must point to the 'phan' file"
+ echo "in a checkout of https://github.com/etsy/phan.git"
+ echo "Or phan must be included in your PATH"
+ exit 1
+ fi
+else
+ export PHAN="$PHP $PHAN"
fi
if [ -z "$MW_INSTALL_PATH" ]; then
# If the first argument doesn't start with a -, then it's a path
# to another project (extension, skin, etc.) to analyze
-if [[ "$1" != "-"* ]]; then
+if [[ -n "$1" && "$1" != "-"* ]]; then
cd $1
shift
else
# Run the analysis, emitting output to the
# issues file.
-php7.0 $PHAN \
+$PHAN \
--project-root-directory "$ROOT" \
--config-file "$CONFIG_FILE" \
--output "php://stdout" \