1
0
Fork 0

Avoid checking for unbounded constraints in platform checks

pull/8918/head
Jordi Boggiano 2020-05-19 17:15:08 +02:00
parent 62d0443e07
commit 45d3e133a4
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
6 changed files with 36 additions and 28 deletions

8
composer.lock generated
View File

@ -83,12 +83,12 @@
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "e639bd3c21f90c8368e6c4a87fd4491f8b21eb2c"
"reference": "594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/e639bd3c21f90c8368e6c4a87fd4491f8b21eb2c",
"reference": "e639bd3c21f90c8368e6c4a87fd4491f8b21eb2c",
"url": "https://api.github.com/repos/composer/semver/zipball/594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89",
"reference": "594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89",
"shasum": ""
},
"require": {
@ -156,7 +156,7 @@
"type": "tidelift"
}
],
"time": "2020-05-19T14:21:25+00:00"
"time": "2020-05-19T14:49:33+00:00"
},
{
"name": "composer/spdx-licenses",

View File

@ -648,14 +648,34 @@ EOF;
return implode('.', $chunks);
};
$lowestOperator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
$highestOperator = $highestPhpVersion->isInclusive() ? '<=' : '<';
$lowestPhpVersionId = $formatToPhpVersionId($lowestPhpVersion);
$highestPhpVersionId = $formatToPhpVersionId($highestPhpVersion);
$lowestPhpVersion = $formatToHumanReadable($lowestPhpVersion);
$highestPhpVersion = $formatToHumanReadable($highestPhpVersion);
$requiredExtensions = implode('', $requiredExtensions);
$requiredPhp = array();
$requiredPhpError = array();
if (!$lowestPhpVersion->isZero()) {
$operator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
$requiredPhp[] = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
$requiredPhpError[] = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
}
if (!$highestPhpVersion->isPositiveInfinity()) {
$operator = $highestPhpVersion->isInclusive() ? '<=' : '<';
$requiredPhp[] = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($highestPhpVersion);
$requiredPhpError[] = '"'.$operator.' '.$formatToHumanReadable($highestPhpVersion).'"';
}
if ($requiredPhp) {
$requiredPhp = implode(' && ', $requiredPhp);
$requiredPhpError = implode(' and ', $requiredPhpError);
$requiredPhp = <<<PHP_CHECK
if (!($requiredPhp)) {
\$issues[] = 'Your Composer dependencies require a PHP version $requiredPhpError. You are running ' . PHP_VERSION . '.';
}
PHP_CHECK;
} else {
$requiredPhp = '';
}
$requiredExtensions = implode('', $requiredExtensions);
if ('' !== $requiredExtensions) {
$requiredExtensions = <<<EXT_CHECKS
@ -674,11 +694,7 @@ EXT_CHECKS;
// platform_check.php @generated by Composer
\$issues = array();
if (!(PHP_VERSION_ID $lowestOperator $lowestPhpVersionId && PHP_VERSION_ID $highestOperator $highestPhpVersionId)) {
\$issues[] = 'Your Composer dependencies require a PHP version "$lowestOperator $lowestPhpVersion" and "$highestOperator $highestPhpVersion". You are running ' . PHP_VERSION . '.';
}
$requiredExtensions
${requiredPhp}${requiredExtensions}
if (\$issues) {
echo 'Composer detected issues in your platform:' . "\\n\\n" . implode("\\n", \$issues);
exit(104);

View File

@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 0 && PHP_VERSION_ID < 80000)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 0" and "< 8.0.0". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID < 80000)) {
$issues[] = 'Your Composer dependencies require a PHP version "< 8.0.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {

View File

@ -4,10 +4,6 @@
$issues = array();
if (!(PHP_VERSION_ID >= 0 && PHP_VERSION_ID < 99999)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 0" and "< 99999". You are running ' . PHP_VERSION . '.';
}
$missingExtensions = array();
extension_loaded('json') || $missingExtensions[] = 'json';
extension_loaded('xml') || $missingExtensions[] = 'xml';

View File

@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 70200 && PHP_VERSION_ID < 99999)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0" and "< 99999". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID >= 70200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {

View File

@ -4,10 +4,6 @@
$issues = array();
if (!(PHP_VERSION_ID >= 0 && PHP_VERSION_ID < 99999)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 0" and "< 99999". You are running ' . PHP_VERSION . '.';
}
$missingExtensions = array();
extension_loaded('pdo') || $missingExtensions[] = 'pdo';