Преглед на файлове

Merge pull request #7467 from staabm/less-count

Use variable to call count() less often
Rob преди 7 години
родител
ревизия
006c921abd
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      src/Composer/DependencyResolver/RuleWatchNode.php

+ 3 - 2
src/Composer/DependencyResolver/RuleWatchNode.php

@@ -37,8 +37,9 @@ class RuleWatchNode
 
         $literals = $rule->getLiterals();
 
-        $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
-        $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
+        $literalCount = count($literals);
+        $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
+        $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
     }
 
     /**