diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index 3c46c0c41..38e41164a 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -677,8 +677,8 @@ class Solver $systemLevel = $level; } - for ($i = 0, $n = 0; $n < count($this->rules); $i++, $n++) { - if ($i == count($this->rules)) { + for ($i = 0, $n = 0, $count = count($this->rules); $n < $count; $i++, $n++) { + if ($i == $count) { $i = 0; } diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index 9c6e35812..2440b6b6a 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -372,7 +372,7 @@ class VersionParser $pairs = array_values($pairs); $result = array(); - for ($i = 0; $i < count($pairs); $i++) { + for ($i = 0, $count = count($pairs); $i < $count; $i++) { $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i])); if (false === strpos($pair, ' ') && isset($pairs[$i+1]) && false === strpos($pairs[$i+1], '/')) { $pair .= ' '.$pairs[$i+1];