Skip to content

Commit

Permalink
Fix: Avoid reassigning values to variables (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz authored Jan 13, 2023
1 parent 4d72a10 commit 01e2ce5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/VersionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,16 @@ public function parseConstraints($constraints)
}
$orGroups = array();

foreach ($orConstraints as $constraints) {
$andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
foreach ($orConstraints as $orConstraint) {
$andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
if (false === $andConstraints) {
throw new \RuntimeException('Failed to preg_split string: '.$constraints);
throw new \RuntimeException('Failed to preg_split string: '.$orConstraint);
}
if (\count($andConstraints) > 1) {
$constraintObjects = array();
foreach ($andConstraints as $constraint) {
foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
$constraintObjects[] = $parsedConstraint;
foreach ($andConstraints as $andConstraint) {
foreach ($this->parseConstraint($andConstraint) as $parsedAndConstraint) {
$constraintObjects[] = $parsedAndConstraint;
}
}
} else {
Expand All @@ -285,11 +285,11 @@ public function parseConstraints($constraints)
$orGroups[] = $constraint;
}

$constraint = MultiConstraint::create($orGroups, false);
$parsedConstraint = MultiConstraint::create($orGroups, false);

$constraint->setPrettyString($prettyConstraint);
$parsedConstraint->setPrettyString($prettyConstraint);

return $constraint;
return $parsedConstraint;
}

/**
Expand Down

0 comments on commit 01e2ce5

Please sign in to comment.