1
0
Fork 0

Fix handling of aliases to use consistent format everywhere

pull/8752/head
Jordi Boggiano 2020-04-08 12:20:18 +02:00
parent a695f686c3
commit 64f907f93f
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 9 additions and 21 deletions

View File

@ -122,8 +122,10 @@ class LockTransaction extends Transaction
foreach ($this->resultPackages['all'] as $package) {
if ($package instanceof AliasPackage) {
if (isset($aliases[$package->getName()])) {
$usedAliases[$package->getName()] = $aliases[$package->getName()];
foreach ($aliases as $alias) {
if ($alias['package'] === $package->getName()) {
$usedAliases[] = $alias;
}
}
}
}

View File

@ -317,24 +317,13 @@ class Locker
'content-hash' => $this->contentHash,
'packages' => null,
'packages-dev' => null,
'aliases' => array(),
'aliases' => $aliases,
'minimum-stability' => $minimumStability,
'stability-flags' => $stabilityFlags,
'prefer-stable' => $preferStable,
'prefer-lowest' => $preferLowest,
);
foreach ($aliases as $package => $versions) {
foreach ($versions as $version => $alias) {
$lock['aliases'][] = array(
'alias' => $alias['alias'],
'alias_normalized' => $alias['alias_normalized'],
'version' => $version,
'package' => $package,
);
}
}
$lock['packages'] = $this->lockPackages($packages);
if (null !== $devPackages) {
$lock['packages-dev'] = $this->lockPackages($devPackages);

View File

@ -46,12 +46,9 @@ class PoolBuilderTest extends TestCase
}, $stabilityFlags);
$parser = new VersionParser();
$normalizedAliases = array();
foreach ($rootAliases as $alias) {
$normalizedAliases[$alias['package']][$parser->normalize($alias['version'])] = array(
'alias' => $alias['alias'],
'alias_normalized' => $parser->normalize($alias['alias']),
);
foreach ($rootAliases as $index => $alias) {
$rootAliases[$index]['version'] = $parser->normalize($alias['version']);
$rootAliases[$index]['alias_normalized'] = $parser->normalize($alias['alias']);
}
$loader = new ArrayLoader();
@ -74,7 +71,7 @@ class PoolBuilderTest extends TestCase
return $pkg;
};
$repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $normalizedAliases);
$repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases);
$repositorySet->addRepository($repo = new ArrayRepository());
foreach ($packages as $package) {
$repo->addPackage($loadPackage($package));