Преглед изворни кода

Ignore null rules in rule generator

Fixes #806
Nils Adermann пре 12 година
родитељ
комит
dc2a9bfe62
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      src/Composer/DependencyResolver/RuleSetGenerator.php

+ 2 - 2
src/Composer/DependencyResolver/RuleSetGenerator.php

@@ -127,14 +127,14 @@ class RuleSetGenerator
      * Adds a rule unless it duplicates an existing one of any type
      *
      * To be able to directly pass in the result of one of the rule creation
-     * methods.
+     * methods null is allowed which will not insert a rule.
      *
      * @param int  $type    A TYPE_* constant defining the rule type
      * @param Rule $newRule The rule about to be added
      */
     private function addRule($type, Rule $newRule = null)
     {
-        if ($this->rules->containsEqual($newRule)) {
+        if (!$newRule || $this->rules->containsEqual($newRule)) {
             return;
         }