From 2bb3f08fba5617527e4ea2da476d58f708e009bc Mon Sep 17 00:00:00 2001 From: Colin O'Dell Date: Sun, 19 Jul 2020 09:57:33 -0400 Subject: [PATCH] Fix checks for phpunit releases on Composer 2 (resolves #37601) --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 27ea603711..7b5e3b1675 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -117,7 +117,11 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ 'requires' => array('php' => '*'), ); - if (1 === count($info['versions'])) { + $stableVersions = array_filter($info['versions'], function($v) { + return !preg_match('/-dev$|^dev-/', $v); + }); + + if (!$stableVersions) { $passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress -s dev phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\""); } else { $passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\"");