Skip to content

Commit a64fad2

Browse files
authored
Fix psalm install error on future php releases (php-curl-class#930)
* Skip running psalm on future PHP releases * Clean up indentation
1 parent 58962a0 commit a64fad2

File tree

4 files changed

+41
-20
lines changed

4 files changed

+41
-20
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"phpcsstandards/phpcsutils": "@alpha",
3030
"phpstan/phpstan": "*",
3131
"phpunit/phpunit": "*",
32-
"squizlabs/php_codesniffer": "*",
33-
"vimeo/psalm": ">=5.26.1"
32+
"squizlabs/php_codesniffer": "*"
3433
},
3534
"suggest": {
3635
"ext-mbstring": "*"

tests/run.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ errors=()
66

77
if [[ "${CI}" == "true" ]]; then
88
composer self-update
9+
10+
# Skip attempting to install psalm on future PHP releases to avoid the
11+
# following error that would otherwise block the remaining tests from
12+
# running:
13+
# Your requirements could not be resolved to an installable set of packages.
14+
#
15+
# Problem 1
16+
# - Root composer.json requires vimeo/psalm >=5.26.1 -> satisfiable by vimeo/psalm[5.26.1, 6.0.0, ..., 6.8.8].
17+
# - 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.
18+
# - 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.
19+
# - 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.
20+
#
21+
# Error: Your requirements could not be resolved to an installable set of packages.
22+
if ! "${CI_PHP_FUTURE_RELEASE}"; then
23+
composer require --dev "vimeo/psalm:>=5.26.1"
24+
fi
25+
926
composer install --prefer-source --no-interaction
1027
if [[ "${?}" -ne 0 ]]; then
1128
echo "❌ Error: composer install failed"

tests/run_coding_standards_check.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,15 @@ fi
123123
# https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/8300
124124
if [[ $(echo "${CI_PHP_VERSION} < 8.4" | bc -l) -eq 1 ]]; then
125125

126-
# Run PHP-CS-Fixer.
127-
vendor/bin/php-cs-fixer --version
128-
vendor/bin/php-cs-fixer fix --ansi --config="tests/.php-cs-fixer.php" --diff --dry-run
129-
if [[ "${?}" -ne 0 ]]; then
130-
echo "❌ Error: found PHP-CS-Fixer coding standard violation(s)"
131-
errors+=("found PHP-CS-Fixer coding standard violation(s)")
132-
fi
133-
126+
# Run PHP-CS-Fixer.
127+
vendor/bin/php-cs-fixer --version
128+
vendor/bin/php-cs-fixer fix --ansi --config="tests/.php-cs-fixer.php" --diff --dry-run
129+
if [[ "${?}" -ne 0 ]]; then
130+
echo "❌ Error: found PHP-CS-Fixer coding standard violation(s)"
131+
errors+=("found PHP-CS-Fixer coding standard violation(s)")
132+
fi
133+
else
134+
echo "⚠️ Skipped running PHP-CS-Fixer coding standards check"
134135
fi
135136

136137
popd

tests/run_static_analysis_check_psalm.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@ pushd ..
1010

1111
set -x
1212

13-
vendor/bin/psalm --version
14-
15-
if [[ $(echo "${CI_PHP_VERSION} == 7.4" | bc -l) -eq 1 ]]; then
16-
vendor/bin/psalm --config="tests/psalm_7.4.xml"
13+
if [[ ! -f "vendor/bin/psalm" ]]; then
14+
echo "⚠️ Skipped running psalm static analysis check"
1715
else
18-
vendor/bin/psalm --config="tests/psalm.xml"
19-
fi
20-
21-
if [[ "${?}" -ne 0 ]]; then
22-
echo "❌ Error: psalm static analysis check failed"
23-
errors+=("psalm static analysis check failed")
16+
vendor/bin/psalm --version
17+
18+
if [[ $(echo "${CI_PHP_VERSION} == 7.4" | bc -l) -eq 1 ]]; then
19+
vendor/bin/psalm --config="tests/psalm_7.4.xml"
20+
else
21+
vendor/bin/psalm --config="tests/psalm.xml"
22+
fi
23+
24+
if [[ "${?}" -ne 0 ]]; then
25+
echo "❌ Error: psalm static analysis check failed"
26+
errors+=("psalm static analysis check failed")
27+
fi
2428
fi
2529

2630
popd

0 commit comments

Comments
 (0)