From ab02867015786c742e2a57d3be0eb50648945088 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 1 May 2015 16:16:02 +0100 Subject: [PATCH] Use natural sort to sort packages, refs #3872 --- src/Composer/Json/JsonManipulator.php | 2 +- tests/Composer/Test/Json/JsonManipulatorTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Composer/Json/JsonManipulator.php b/src/Composer/Json/JsonManipulator.php index f46d28e08..4e59544c9 100644 --- a/src/Composer/Json/JsonManipulator.php +++ b/src/Composer/Json/JsonManipulator.php @@ -137,7 +137,7 @@ class JsonManipulator }; uksort($packages, function ($a, $b) use ($prefix) { - return strcmp($prefix($a), $prefix($b)); + return strnatcmp($prefix($a), $prefix($b)); }); } diff --git a/tests/Composer/Test/Json/JsonManipulatorTest.php b/tests/Composer/Test/Json/JsonManipulatorTest.php index b56f4bc0d..ea14222c8 100644 --- a/tests/Composer/Test/Json/JsonManipulatorTest.php +++ b/tests/Composer/Test/Json/JsonManipulatorTest.php @@ -336,8 +336,8 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase '{ "require": { "foo": "baz", - "ext-mcrypt": "*", - "ext-gd": "*", + "ext-10gd": "*", + "ext-2mcrypt": "*", "lib-foo": "*", "hhvm": "*", "php": ">=5.5" @@ -351,8 +351,8 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase "require": { "php": ">=5.5", "hhvm": "*", - "ext-gd": "*", - "ext-mcrypt": "*", + "ext-2mcrypt": "*", + "ext-10gd": "*", "lib-foo": "*", "foo": "baz", "igorw/retry": "*"