Skip to content

Commit 74117fb

Browse files
EhEhRon91nicolas-grekas
authored andcommitted
removed unnecessary code
1 parent f16f107 commit 74117fb

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

src/Flex.php

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -307,17 +307,6 @@ public function configureInstaller()
307307
return $backtrace;
308308
}
309309

310-
public function lockPlatform()
311-
{
312-
if (!$this->downloader->isEnabled()) {
313-
return; // "symfony/flex" not found in the root composer.json - don't create the symfony.lock file
314-
}
315-
316-
$this->lock->set('php', [
317-
'version' => $this->config->get('platform')['php'] ?? (\PHP_MAJOR_VERSION.'.'.\PHP_MINOR_VERSION),
318-
]);
319-
}
320-
321310
public function configureProject(Event $event)
322311
{
323312
if (!$this->downloader->isEnabled()) {
@@ -700,40 +689,6 @@ public function onFileDownload(PreFileDownloadEvent $event)
700689
}
701690
}
702691

703-
public function updateAutoloadFile()
704-
{
705-
if (!$platform = $this->lock->get('php')['version'] ?? null) {
706-
return;
707-
}
708-
709-
$autoloadFile = $this->config->get('vendor-dir').'/autoload.php';
710-
711-
if (!file_exists($autoloadFile)) {
712-
return;
713-
}
714-
715-
$code = file_get_contents($autoloadFile);
716-
$code = substr($code, \strlen("<?php\n"));
717-
718-
if (false !== strpos($code, 'PHP_VERSION_ID')) {
719-
return;
720-
}
721-
722-
$platform = preg_replace('/[^-+.~_\w]/', '', $platform);
723-
$version = sprintf('%d%02d00', ...explode('.', $platform.'.0'));
724-
725-
file_put_contents($autoloadFile, <<<EOPHP
726-
<?php
727-
728-
if (PHP_VERSION_ID < $version) {
729-
echo sprintf("Fatal Error: composer.lock was created for PHP version $platform or higher but the current PHP version is %d.%d.%s.\\n", PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION);
730-
exit(1);
731-
}
732-
$code
733-
EOPHP
734-
);
735-
}
736-
737692
/**
738693
* @return Recipe[]
739694
*/
@@ -1010,14 +965,13 @@ public static function getSubscribedEvents(): array
1010965
ScriptEvents::POST_INSTALL_CMD => 'install',
1011966
ScriptEvents::PRE_UPDATE_CMD => 'configureInstaller',
1012967
ScriptEvents::POST_UPDATE_CMD => 'update',
1013-
ScriptEvents::POST_AUTOLOAD_DUMP => 'updateAutoloadFile',
1014968
'auto-scripts' => 'executeAutoScripts',
1015969
];
1016970

1017971
if (version_compare('2.0.0', PluginInterface::PLUGIN_API_VERSION, '>')) {
1018972
$events += [
1019973
InstallerEvents::PRE_DEPENDENCIES_SOLVING => [['populateProvidersCacheDir', \PHP_INT_MAX]],
1020-
InstallerEvents::POST_DEPENDENCIES_SOLVING => [['populateFilesCacheDir', \PHP_INT_MAX], ['lockPlatform']],
974+
InstallerEvents::POST_DEPENDENCIES_SOLVING => [['populateFilesCacheDir', \PHP_INT_MAX]],
1021975
PackageEvents::PRE_PACKAGE_INSTALL => [['populateFilesCacheDir', ~\PHP_INT_MAX]],
1022976
PackageEvents::PRE_PACKAGE_UPDATE => [['populateFilesCacheDir', ~\PHP_INT_MAX]],
1023977
PluginEvents::PRE_FILE_DOWNLOAD => 'onFileDownload',

0 commit comments

Comments
 (0)