Reverse-orders namespaces by specificity
parent
0cfbea624e
commit
bd712db727
|
@ -73,11 +73,9 @@ EOF;
|
||||||
|
|
||||||
if (isset($autoloads['psr-0'])) {
|
if (isset($autoloads['psr-0'])) {
|
||||||
foreach ($autoloads['psr-0'] as $def) {
|
foreach ($autoloads['psr-0'] as $def) {
|
||||||
foreach ($def['mapping'] as $prefix => $path) {
|
$exportedPrefix = var_export($def['namespace'], true);
|
||||||
$exportedPrefix = var_export($prefix, true);
|
$exportedPath = var_export($def['path'], true);
|
||||||
$exportedPath = var_export(($def['path'] ? '/'.$def['path'] : '').'/'.$path, true);
|
$namespacesFile .= " $exportedPrefix => dirname(dirname(__DIR__)).$exportedPath,\n";
|
||||||
$namespacesFile .= " $exportedPrefix => dirname(dirname(__DIR__)).$exportedPath,\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,13 +105,21 @@ EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($package->getAutoload() as $type => $mapping) {
|
foreach ($package->getAutoload() as $type => $mapping) {
|
||||||
$autoloads[$type][] = array(
|
foreach ($mapping as $namespace => $path) {
|
||||||
'mapping' => $mapping,
|
$autoloads[$type][] = array(
|
||||||
'path' => $installPath,
|
'namespace' => $namespace,
|
||||||
);
|
'path' => ($installPath ? '/'.$installPath : '').'/'.$path,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($autoloads as $type => $maps) {
|
||||||
|
usort($autoloads[$type], function ($a, $b) {
|
||||||
|
return strcmp($b['namespace'], $a['namespace']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return $autoloads;
|
return $autoloads;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue