@@ -307,17 +307,6 @@ public function configureInstaller()
307
307
return $ backtrace ;
308
308
}
309
309
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
-
321
310
public function configureProject (Event $ event )
322
311
{
323
312
if (!$ this ->downloader ->isEnabled ()) {
@@ -700,40 +689,6 @@ public function onFileDownload(PreFileDownloadEvent $event)
700
689
}
701
690
}
702
691
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
-
737
692
/**
738
693
* @return Recipe[]
739
694
*/
@@ -1010,14 +965,13 @@ public static function getSubscribedEvents(): array
1010
965
ScriptEvents::POST_INSTALL_CMD => 'install ' ,
1011
966
ScriptEvents::PRE_UPDATE_CMD => 'configureInstaller ' ,
1012
967
ScriptEvents::POST_UPDATE_CMD => 'update ' ,
1013
- ScriptEvents::POST_AUTOLOAD_DUMP => 'updateAutoloadFile ' ,
1014
968
'auto-scripts ' => 'executeAutoScripts ' ,
1015
969
];
1016
970
1017
971
if (version_compare ('2.0.0 ' , PluginInterface::PLUGIN_API_VERSION , '> ' )) {
1018
972
$ events += [
1019
973
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 ]],
1021
975
PackageEvents::PRE_PACKAGE_INSTALL => [['populateFilesCacheDir ' , ~\PHP_INT_MAX ]],
1022
976
PackageEvents::PRE_PACKAGE_UPDATE => [['populateFilesCacheDir ' , ~\PHP_INT_MAX ]],
1023
977
PluginEvents::PRE_FILE_DOWNLOAD => 'onFileDownload ' ,
0 commit comments