Browse Source

Ignore self references when anlaysing independent root requirements

When creating a transaction we try to identify all requirements that are
not themselves required by any other package. If a package references
itself this should not mark it as being required by another package.
Nils Adermann 9 years ago
parent
commit
4af74b54e0

+ 3 - 1
src/Composer/DependencyResolver/Transaction.php

@@ -165,7 +165,9 @@ class Transaction
                 $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
 
                 foreach ($possibleRequires as $require) {
-                    unset($roots[$require->id]);
+                    if ($require !== $package) {
+                        unset($roots[$require->id]);
+                    }
                 }
             }
         }

+ 1 - 4
tests/Composer/Test/Fixtures/installer/circular-dependency2.test

@@ -23,10 +23,7 @@ Circular dependencies are possible between packages
                 {
                     "name": "regular/pkg",
                     "version": "1.0.0",
-                    "source": { "reference": "some.branch", "type": "git", "url": "" },
-                    "__dummy__require": {
-                        "require/itself": "1.0.0"
-                    }
+                    "source": { "reference": "some.branch", "type": "git", "url": "" }
                 }
             ]
         }