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