diff --git a/composer.json b/composer.json index 0e7a8bbc2..8eb824cf5 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,7 @@ "phpcsstandards/phpcsutils": "@alpha", "phpstan/phpstan": "*", "phpunit/phpunit": "*", - "squizlabs/php_codesniffer": "*", - "vimeo/psalm": ">=5.26.1" + "squizlabs/php_codesniffer": "*" }, "suggest": { "ext-mbstring": "*" diff --git a/tests/run.sh b/tests/run.sh index 4c6695435..9a72e4485 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -6,6 +6,23 @@ errors=() if [[ "${CI}" == "true" ]]; then composer self-update + + # Skip attempting to install psalm on future PHP releases to avoid the + # following error that would otherwise block the remaining tests from + # running: + # Your requirements could not be resolved to an installable set of packages. + # + # Problem 1 + # - Root composer.json requires vimeo/psalm >=5.26.1 -> satisfiable by vimeo/psalm[5.26.1, 6.0.0, ..., 6.8.8]. + # - vimeo/psalm 5.26.1 requires php ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 -> your php version (8.5.0-dev) does not satisfy that requirement. + # - vimeo/psalm[6.0.0, ..., 6.5.0] require php ~8.1.17 || ~8.2.4 || ~8.3.0 || ~8.4.0 -> your php version (8.5.0-dev) does not satisfy that requirement. + # - vimeo/psalm[6.5.1, ..., 6.8.8] require php ~8.1.31 || ~8.2.27 || ~8.3.16 || ~8.4.3 -> your php version (8.5.0-dev) does not satisfy that requirement. + # + # Error: Your requirements could not be resolved to an installable set of packages. + if ! "${CI_PHP_FUTURE_RELEASE}"; then + composer require --dev "vimeo/psalm:>=5.26.1" + fi + composer install --prefer-source --no-interaction if [[ "${?}" -ne 0 ]]; then echo "❌ Error: composer install failed" diff --git a/tests/run_coding_standards_check.sh b/tests/run_coding_standards_check.sh index 7f0485213..8a6b83219 100755 --- a/tests/run_coding_standards_check.sh +++ b/tests/run_coding_standards_check.sh @@ -123,14 +123,15 @@ fi # https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/8300 if [[ $(echo "${CI_PHP_VERSION} < 8.4" | bc -l) -eq 1 ]]; then -# Run PHP-CS-Fixer. -vendor/bin/php-cs-fixer --version -vendor/bin/php-cs-fixer fix --ansi --config="tests/.php-cs-fixer.php" --diff --dry-run -if [[ "${?}" -ne 0 ]]; then - echo "❌ Error: found PHP-CS-Fixer coding standard violation(s)" - errors+=("found PHP-CS-Fixer coding standard violation(s)") -fi - + # Run PHP-CS-Fixer. + vendor/bin/php-cs-fixer --version + vendor/bin/php-cs-fixer fix --ansi --config="tests/.php-cs-fixer.php" --diff --dry-run + if [[ "${?}" -ne 0 ]]; then + echo "❌ Error: found PHP-CS-Fixer coding standard violation(s)" + errors+=("found PHP-CS-Fixer coding standard violation(s)") + fi +else + echo "⚠️ Skipped running PHP-CS-Fixer coding standards check" fi popd diff --git a/tests/run_static_analysis_check_psalm.sh b/tests/run_static_analysis_check_psalm.sh index 2f1c048eb..2c5b6e259 100755 --- a/tests/run_static_analysis_check_psalm.sh +++ b/tests/run_static_analysis_check_psalm.sh @@ -10,17 +10,21 @@ pushd .. set -x -vendor/bin/psalm --version - -if [[ $(echo "${CI_PHP_VERSION} == 7.4" | bc -l) -eq 1 ]]; then - vendor/bin/psalm --config="tests/psalm_7.4.xml" +if [[ ! -f "vendor/bin/psalm" ]]; then + echo "⚠️ Skipped running psalm static analysis check" else - vendor/bin/psalm --config="tests/psalm.xml" -fi - -if [[ "${?}" -ne 0 ]]; then - echo "❌ Error: psalm static analysis check failed" - errors+=("psalm static analysis check failed") + vendor/bin/psalm --version + + if [[ $(echo "${CI_PHP_VERSION} == 7.4" | bc -l) -eq 1 ]]; then + vendor/bin/psalm --config="tests/psalm_7.4.xml" + else + vendor/bin/psalm --config="tests/psalm.xml" + fi + + if [[ "${?}" -ne 0 ]]; then + echo "❌ Error: psalm static analysis check failed" + errors+=("psalm static analysis check failed") + fi fi popd