Skip to content

Commit

Permalink
Fixed VersionParser being unable to parse its own MultiConstraint format
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Jun 8, 2023
1 parent fa1ec24 commit 7110172
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/VersionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function parseConstraints($constraints)
$orGroups = array();

foreach ($orConstraints as $orConstraint) {
$andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
$andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', trim($orConstraint, '[]'));
if (false === $andConstraints) {
throw new \RuntimeException('Failed to preg_split string: '.$orConstraint);
}
Expand Down
1 change: 1 addition & 0 deletions tests/VersionParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ public function testParseConstraintsMulti($constraint)
$multi = new MultiConstraint(array($first, $second));

$this->assertSame((string) $multi, (string) $parser->parseConstraints($constraint));
$this->assertSame((string) $multi, (string) $parser->parseConstraints((string) $multi));
}

/**
Expand Down

0 comments on commit 7110172

Please sign in to comment.