Skip to content

Commit

Permalink
bug #906 Fix compat with old composer versions (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Fix compat with old composer versions

Fix #893

Commits
-------

01c41aa Fix compat with old composer versions
  • Loading branch information
nicolas-grekas committed May 2, 2022
2 parents ec578e9 + 01c41aa commit 63fdd79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Command/UnpackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
->setDumpAutoloader(false)
->setIgnorePlatformRequirements(true)
->setUpdate(true)
->setUpdateAllowList(['php'])
;

if (method_exists($installer, 'setUpdateAllowList')) {
$installer->setUpdateAllowList(['php']);
} else {
$installer->setUpdateWhiteList(['php']);
}

if (method_exists($composer->getEventDispatcher(), 'setRunScripts')) {
$composer->getEventDispatcher()->setRunScripts(false);
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/Flex.php
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,10 @@ private function reinstall(Event $event, bool $update)
$composer->getAutoloadGenerator()
);

if (!$update) {
if (!$update && method_exists($installer, 'setUpdateAllowList')) {
$installer->setUpdateAllowList(['php']);
} elseif (!$update) {
$installer->setUpdateWhiteList(['php']);
}

if (method_exists($installer, 'setSkipSuggest')) {
Expand Down

0 comments on commit 63fdd79

Please sign in to comment.