Remove upper bound PHP version checks from platform-check as there is not enough value added and it risks causing issues
parent
0a0291e913
commit
21e708f2c4
|
@ -316,7 +316,13 @@ EOF;
|
|||
$filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
|
||||
$checkPlatform = $config->get('platform-check');
|
||||
if ($checkPlatform) {
|
||||
$filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $this->getPlatformCheck($packageMap));
|
||||
$platformCheckContent = $this->getPlatformCheck($packageMap);
|
||||
if (null === $platformCheckContent) {
|
||||
$checkPlatform = false;
|
||||
}
|
||||
}
|
||||
if ($checkPlatform) {
|
||||
$filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $platformCheckContent);
|
||||
} elseif (file_exists($targetDir.'/platform_check.php')) {
|
||||
unlink($targetDir.'/platform_check.php');
|
||||
}
|
||||
|
@ -572,7 +578,6 @@ EOF;
|
|||
protected function getPlatformCheck($packageMap)
|
||||
{
|
||||
$lowestPhpVersion = Bound::zero();
|
||||
$highestPhpVersion = Bound::positiveInfinity();
|
||||
$requiredExtensions = array();
|
||||
$extensionProviders = array();
|
||||
|
||||
|
@ -592,9 +597,6 @@ EOF;
|
|||
if ($constraint->getLowerBound()->compareTo($lowestPhpVersion, '>')) {
|
||||
$lowestPhpVersion = $constraint->getLowerBound();
|
||||
}
|
||||
if ($constraint->getUpperBound()->compareTo($highestPhpVersion, '<')) {
|
||||
$highestPhpVersion = $constraint->getUpperBound();
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
|
||||
|
@ -648,22 +650,15 @@ EOF;
|
|||
return implode('.', $chunks);
|
||||
};
|
||||
|
||||
$requiredPhp = array();
|
||||
$requiredPhpError = array();
|
||||
$requiredPhp = '';
|
||||
$requiredPhpError = '';
|
||||
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).'"';
|
||||
$requiredPhp = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
|
||||
$requiredPhpError = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
|
||||
}
|
||||
|
||||
if ($requiredPhp) {
|
||||
$requiredPhp = implode(' && ', $requiredPhp);
|
||||
$requiredPhpError = implode(' and ', $requiredPhpError);
|
||||
$requiredPhp = <<<PHP_CHECK
|
||||
|
||||
if (!($requiredPhp)) {
|
||||
|
@ -671,8 +666,6 @@ if (!($requiredPhp)) {
|
|||
}
|
||||
|
||||
PHP_CHECK;
|
||||
} else {
|
||||
$requiredPhp = '';
|
||||
}
|
||||
|
||||
$requiredExtensions = implode('', $requiredExtensions);
|
||||
|
@ -688,6 +681,10 @@ if (\$missingExtensions) {
|
|||
EXT_CHECKS;
|
||||
}
|
||||
|
||||
if (!$requiredPhp && !$requiredExtensions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <<<PLATFORM_CHECK
|
||||
<?php
|
||||
|
||||
|
|
|
@ -1667,7 +1667,13 @@ EOF;
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||
|
||||
if (null === $expectedFixture) {
|
||||
$this->assertFalse(file_exists($this->vendorDir . '/composer/platform_check.php'));
|
||||
$this->assertNotContains("require __DIR__ . '/platform_check.php';", file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
} else {
|
||||
$this->assertFileContentEquals(__DIR__ . '/Fixtures/platform/' . $expectedFixture . '.php', $this->vendorDir . '/composer/platform_check.php');
|
||||
$this->assertContains("require __DIR__ . '/platform_check.php';", file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||
}
|
||||
}
|
||||
|
||||
public function platformCheckProvider()
|
||||
|
@ -1687,7 +1693,7 @@ EOF;
|
|||
array(
|
||||
new Link('a', 'php', $versionParser->parseConstraints('< 8')),
|
||||
),
|
||||
'no_php_lower_bound'
|
||||
null
|
||||
),
|
||||
'No PHP upper bound' => array(
|
||||
array(
|
||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoloadOrder
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
|
||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitIncludePath
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'));
|
||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitTargetDir
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'));
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70200 && PHP_VERSION_ID < 80000)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0" and "< 8.0.0". 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) {
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID < 80000)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version "< 8.0.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
echo 'Composer detected issues in your platform:' . "\n\n" . implode("\n", $issues);
|
||||
exit(104);
|
||||
}
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70208 && PHP_VERSION_ID < 80000)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.8" and "< 8.0.0". You are running ' . PHP_VERSION . '.';
|
||||
if (!(PHP_VERSION_ID >= 70208)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.8". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70200 && PHP_VERSION_ID < 80000)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0" and "< 8.0.0". 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 . '.';
|
||||
}
|
||||
|
||||
$missingExtensions = array();
|
||||
|
|
Loading…
Reference in New Issue