Added tests for consistency of data in AutoloadGenerator::sortPackageMap
parent
1ff1b8ac1f
commit
9582a8abfa
|
@ -449,30 +449,36 @@ FOOTER;
|
||||||
$groups[$key] = array($item);
|
$groups[$key] = array($item);
|
||||||
$mainName = $item[0]->getName();
|
$mainName = $item[0]->getName();
|
||||||
foreach ($item[0]->getNames() as $name) {
|
foreach ($item[0]->getNames() as $name) {
|
||||||
$names[$name] = $name == $mainName ? $key : $mainName;
|
if (!isset($names[$name])) {
|
||||||
|
$names[$name] = $name == $mainName ? $key : $mainName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($packageMap as $item) {
|
foreach ($packageMap as $item) {
|
||||||
foreach (array_merge($item[0]->getRequires(), $item[0]->getDevRequires()) as $link) {
|
foreach (array_merge($item[0]->getRequires(), $item[0]->getDevRequires()) as $link) {
|
||||||
if (!isset($names[$link->getTarget()])) {
|
$target = $link->getTarget();
|
||||||
|
if (!isset($names[$target])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$targetKey = $names[$target];
|
||||||
|
if (is_string($targetKey)) {
|
||||||
|
if (!isset($names[$targetKey])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$targetKey = $names[$targetKey];
|
||||||
|
}
|
||||||
|
|
||||||
$packageKey = $names[$item[0]->getName()];
|
$packageKey = $names[$item[0]->getName()];
|
||||||
$target = $link->getTarget();
|
if ($targetKey <= $packageKey || !isset($groups[$packageKey])) {
|
||||||
$targetKey = is_int($names[$target]) ? $names[$target] : $names[$names[$target]];
|
|
||||||
|
|
||||||
if ($targetKey <= $packageKey) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$groups[$targetKey] = array_merge($groups[$targetKey], $groups[$packageKey]);
|
|
||||||
|
|
||||||
foreach ($groups[$packageKey] as $originalItem) {
|
foreach ($groups[$packageKey] as $originalItem) {
|
||||||
|
$groups[$targetKey][] = $originalItem;
|
||||||
$names[$originalItem[0]->getName()] = $targetKey;
|
$names[$originalItem[0]->getName()] = $targetKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($groups[$packageKey]);
|
unset($groups[$packageKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue