Fix handling of platform packages to be future proof, refs #3872
parent
081e26f4d7
commit
06fb00bfe5
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
namespace Composer\Json;
|
namespace Composer\Json;
|
||||||
|
|
||||||
|
use Composer\Repository\PlatformRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
*/
|
*/
|
||||||
|
@ -111,23 +113,27 @@ class JsonManipulator
|
||||||
private function sortPackages(array &$packages = array())
|
private function sortPackages(array &$packages = array())
|
||||||
{
|
{
|
||||||
$prefix = function ($requirement) {
|
$prefix = function ($requirement) {
|
||||||
return preg_replace(
|
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
|
||||||
array(
|
return preg_replace(
|
||||||
'/^php$/',
|
array(
|
||||||
'/^hhvm$/',
|
'/^php/',
|
||||||
'/^ext-\w+$/',
|
'/^hhvm/',
|
||||||
'/^lib-\w+$/',
|
'/^ext/',
|
||||||
'/^.+$/',
|
'/^lib/',
|
||||||
),
|
'/^\D/',
|
||||||
array(
|
),
|
||||||
'0-$0',
|
array(
|
||||||
'1-$0',
|
'0-$0',
|
||||||
'2-$0',
|
'1-$0',
|
||||||
'3-$0',
|
'2-$0',
|
||||||
'4-$0',
|
'3-$0',
|
||||||
),
|
'4-$0',
|
||||||
$requirement
|
),
|
||||||
);
|
$requirement
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '5-'.$requirement;
|
||||||
};
|
};
|
||||||
|
|
||||||
uksort($packages, function ($a, $b) use ($prefix) {
|
uksort($packages, function ($a, $b) use ($prefix) {
|
||||||
|
|
Loading…
Reference in New Issue