From b8c0aff9751abf22a40623660495b22b474c3396 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Tue, 6 Jan 2026 18:15:50 +0900 Subject: [PATCH] Update phive phars with correct version and update scripts to use both new "-c" switch for all checking scripts to swtich to the composer version from the phive installed version NOTE: phpstan plugins only work in the composer version. Default is the phive version --- .phive/phars.xml | 8 ++++---- 4dev/checking/phan.sh | 19 ++++++++++++++++++- 4dev/checking/phpstan.sh | 17 ++++++++++++++++- 4dev/checking/phpunit.sh | 25 ++++++++++++++++++++----- 4 files changed, 58 insertions(+), 11 deletions(-) diff --git a/.phive/phars.xml b/.phive/phars.xml index 9c7686d2..4dff671c 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,11 +1,11 @@ - - - + + + - + diff --git a/4dev/checking/phan.sh b/4dev/checking/phan.sh index b44c0c1a..e4833205 100755 --- a/4dev/checking/phan.sh +++ b/4dev/checking/phan.sh @@ -16,6 +16,7 @@ Available options: -h, --help Print this help and exit -p, --php VERSION Chose PHP version in the form of "N.N", if not found will exit +-c, --composer Use composer version and not the default phives bundle EOF exit } @@ -33,12 +34,17 @@ if [ -z "${DEFAULT_PHP_VERSION}" ]; then fi; php_version=""; no_php_version=0; +use_composer=0; while [ -n "${1-}" ]; do case "${1}" in -p | --php) php_version="${2-}"; shift ;; + -c | --composer) + use_composer=1; + shift + ;; -h | --help) usage ;; @@ -55,6 +61,11 @@ if [ -z "${php_version}" ]; then fi; php_bin="${PHP_BIN_PATH}${php_version}"; echo "Use PHP Version: ${php_version}"; +if [ "${use_composer}" -eq 1 ]; then + echo "Use composer installed phan"; +else + echo "Use phan installed via phives"; +fi; if [ ! -f "${php_bin}" ]; then echo "Set php ${php_bin} does not exist"; @@ -66,7 +77,13 @@ cd "$BASE_PATH" || exit; export PHAN_DISABLE_XDEBUG_WARN=1; PHAN_CALL=( "${php_bin}" - "${BASE_PATH}tools/phan" +); +if [ "${use_composer}" -eq 1 ]; then + PHAN_CALL+=("${BASE_PATH}vendor/bin/phan"); +else + PHAN_CALL+=("${BASE_PATH}tools/phan"); +fi; +PHAN_CALL+=( "--progress-bar" "-C" "--analyze-twice" diff --git a/4dev/checking/phpstan.sh b/4dev/checking/phpstan.sh index 6ebcc036..8fc1e647 100755 --- a/4dev/checking/phpstan.sh +++ b/4dev/checking/phpstan.sh @@ -16,6 +16,7 @@ Available options: -h, --help Print this help and exit -p, --php VERSION Chose PHP version in the form of "N.N", if not found will exit +-c, --composer Use composer version and not the default phives bundle EOF exit } @@ -33,12 +34,17 @@ if [ -z "${DEFAULT_PHP_VERSION}" ]; then fi; php_version=""; no_php_version=0; +use_composer=0; while [ -n "${1-}" ]; do case "${1}" in -p | --php) php_version="${2-}"; shift ;; + -c | --composer) + use_composer=1; + shift + ;; -h | --help) usage ;; @@ -55,6 +61,11 @@ if [ -z "${php_version}" ]; then fi; php_bin="${PHP_BIN_PATH}${php_version}"; echo "Use PHP Version: ${php_version}"; +if [ "${use_composer}" -eq 1 ]; then + echo "Use composer installed phan"; +else + echo "Use phan installed via phives"; +fi; if [ ! -f "${php_bin}" ]; then echo "Set php ${php_bin} does not exist"; @@ -65,8 +76,12 @@ BASE_PATH=$(pwd)"/"; cd "$BASE_PATH" || exit; PHPSTAN_CALL=( "${php_bin}" - "${BASE_PATH}tools/phpstan" ); +if [ "${use_composer}" -eq 1 ]; then + PHPSTAN_CALL+=("${BASE_PATH}vendor/bin/phpstan"); +else + PHPSTAN_CALL+=("${BASE_PATH}tools/phpstan"); +fi; "${PHPSTAN_CALL[@]}"; if [ "${no_php_version}" -eq 0 ]; then echo "*** CALLED WITH PHP ${php_bin} ***"; diff --git a/4dev/checking/phpunit.sh b/4dev/checking/phpunit.sh index be7e6168..86d0176b 100755 --- a/4dev/checking/phpunit.sh +++ b/4dev/checking/phpunit.sh @@ -15,8 +15,9 @@ If -p is not set, the default intalled PHP is used. Available options: -h, --help Print this help and exit --t, --testdox Enable testdox output for phpunit +-t, --testdox Enable testdox output for PHPunit -v, --verbose Enable verbose output for PHPunit +-c, --composer Use composer version and not the default phives bundle -p, --php VERSION Chose PHP version in the form of "N.N", if not found will exit EOF exit @@ -45,6 +46,7 @@ opt_testdox=""; opt_verbose=""; php_version=""; no_php_version=0; +use_composer=0; while [ -n "${1-}" ]; do case "${1}" in -t | --testdox) @@ -53,6 +55,10 @@ while [ -n "${1-}" ]; do -v | --verbose) opt_verbose="--verbose"; ;; + -c | --composer) + use_composer=1; + shift + ;; -p | --php) php_version="${2-}"; shift @@ -74,6 +80,11 @@ if [ -z "${php_version}" ]; then fi; php_bin="${PHP_BIN_PATH}${php_version}"; echo "Use PHP Version: ${php_version}"; +if [ "${use_composer}" -eq 1 ]; then + echo "Use composer installed phan"; +else + echo "Use phan installed via phives"; +fi; if [ ! -f "${php_bin}" ]; then echo "Set php ${php_bin} does not exist"; @@ -83,14 +94,18 @@ fi; # Note 4dev/tests/bootstrap.php has to be set as bootstrap file in phpunit.xml PHPUNIT_CALL=( "${php_bin}" - "${BASE_PATH}vendor/bin/phpunit" +); +if [ "${use_composer}" -eq 1 ]; then + PHPUNIT_CALL+=("${BASE_PATH}vendor/bin/phpunit"); +else + PHPUNIT_CALL+=("${BASE_PATH}tools/phpunit"); +fi; +PHPUNIT_CALL+=( "${opt_testdox}" "${opt_verbose}" "-c" "${PHPUNIT_CONFIG}" "${BASE_PATH}4dev/tests/" -) -# phpunit_call="${php_bin}${BASE_PATH}vendor/bin/phpunit ${opt_testdox} ${opt_verbose} -c ${PHPUNIT_CONFIG} ${BASE_PATH}4dev/tests/"; -# ${phpunit_call}; +); "${PHPUNIT_CALL[@]}" || exit; echo -e "\nPHPUnit Config: ${PHPUNIT_CONFIG}";