Explorar o código

Make sure versions are ordered also in the satisfied by package lists

Jordi Boggiano %!s(int64=5) %!d(string=hai) anos
pai
achega
3a64acb53e

+ 4 - 1
src/Composer/DependencyResolver/Problem.php

@@ -113,6 +113,7 @@ class Problem
         foreach (array_unique($messages) as $message) {
             if (isset($templates[$message])) {
                 foreach ($templates[$message] as $package => $versions) {
+                    uksort($versions, 'version_compare');
                     if (!$isVerbose) {
                         $versions = self::condenseVersionList($versions, 1);
                     }
@@ -329,6 +330,9 @@ class Problem
             if (isset($package['versions'][VersionParser::DEV_MASTER_ALIAS]) && isset($package['versions']['dev-master'])) {
                 unset($package['versions'][VersionParser::DEV_MASTER_ALIAS]);
             }
+
+            uksort($package['versions'], 'version_compare');
+
             if (!$isVerbose) {
                 $package['versions'] = self::condenseVersionList($package['versions'], 4);
             }
@@ -348,7 +352,6 @@ class Problem
             return $versions;
         }
 
-        uksort($versions, 'version_compare');
         $filtered = array();
         $byMajor = array();
         foreach ($versions as $version => $pretty) {

+ 1 - 1
tests/Composer/Test/Fixtures/installer/alias-solver-problems.test

@@ -47,7 +47,7 @@ Your requirements could not be resolved to an installable set of packages.
   Problem 1
     - Root composer.json requires b/b *@dev -> satisfiable by b/b[dev-master].
     - a/a dev-master requires d/d 1.0.0 -> satisfiable by d/d[1.0.0].
-    - You can only install one version of a package, so only one of these can be installed: d/d[2.0.0, 1.0.0].
+    - You can only install one version of a package, so only one of these can be installed: d/d[1.0.0, 2.0.0].
     - Conclusion: install d/d 2.0.0, learned rules:
         - Root composer.json requires b/b *@dev -> satisfiable by b/b[dev-master].
         - b/b dev-master requires d/d 2.0.0 -> satisfiable by d/d[2.0.0].

+ 4 - 4
tests/Composer/Test/Fixtures/installer/provider-conflicts3.test

@@ -39,14 +39,14 @@ Your requirements could not be resolved to an installable set of packages.
   Problem 1
     - Conclusion: don't install regular/pkg 1.0.3, learned rules:
         - Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].
-        - Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
+        - Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
     - Conclusion: don't install regular/pkg 1.0.2, learned rules:
         - Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].
-        - Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
+        - Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
     - Conclusion: don't install regular/pkg 1.0.1, learned rules:
         - Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].
-        - Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
-    - Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
+        - Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
+    - Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
     - Root composer.json requires regular/pkg 1.* -> satisfiable by regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3].
     - Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].