Skip to content

Commit 31e3fab

Browse files
Merge branch '5.0' into 5.1
* 5.0: [PhpUnitBridge] fix installing on PHP 8 (ter) [PhpUnitBridge] fix installing on PHP 8 (bis) [PhpUnitBridge] fix installing on PHP 8
2 parents 039a40f + 542ecf9 commit 31e3fab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bin/simple-phpunit.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,11 @@
197197
$passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
198198
}
199199

200-
if ($info['requires']['php'] !== $phpVersion = preg_replace('{\^([\d\.]++)$}', '>=$1', $info['requires']['php'])) {
201-
$passthruOrFail("$COMPOSER require --no-update \"php:$phpVersion\"");
200+
if (preg_match('{\^(\d++\.\d++)[\d\.]*$}', $info['requires']['php'], $phpVersion) && version_compare($phpVersion[1], PHP_VERSION, '<')) {
201+
$passthruOrFail("$COMPOSER config platform.php \"$phpVersion[1].99\"");
202+
} else {
203+
$passthruOrFail("$COMPOSER config --unset platform.php");
202204
}
203-
$passthruOrFail("$COMPOSER config --unset platform.php");
204205
if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
205206
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");
206207
$passthruOrFail("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path)));

0 commit comments

Comments
 (0)