Skip to content

Commit

Permalink
Remove overlapping individual versions too
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden authored and localheinz committed Oct 10, 2023
1 parent 5a926b5 commit fd5c06f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ sections, the `Vendor\Composer\VersionConstraintNormalizer` will ensure that
{
"homepage": "https://getcomposer.org/doc/articles/versions.md#version-range",
"require": {
- "foo/bar": "^1.0 || ^1.1 || ^2.0"
- "foo/bar": "^1.0 || ^1.1 || ^2.0 || ~2.1.0 || 2.4.5"
+ "foo/bar": "^1.0 || ^2.0"
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/Vendor/Composer/VersionConstraintNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private static function removeOverlappingVersionConstraints(string $versionConst
{
$orConstraints = self::splitIntoOrConstraints($versionConstraint);

$regex = '{^[~^]\d+(?:\.\d+)*$}';
$regex = '{^[~^]?\d+(?:\.\d+)*$}';

$count = \count($orConstraints);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"homepage": "https://getcomposer.org/doc/articles/versions.md#version-range",
"value-contains-packages-and-version-constraints": {
"combination-or-version-range-mixed/01": "^1.2",
"combination-or-version-range-mixed/02": "^1.2",
"combination-or-version-range-mixed/03": "^1.2",
"combination-or-version-range-mixed/04": "1.2.1 || ~1.2.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"homepage": "https://getcomposer.org/doc/articles/versions.md#version-range",
"value-contains-packages-and-version-constraints": {
"combination-or-version-range-mixed/01": "1.2.3 || ^1.2",
"combination-or-version-range-mixed/02": "~1.2.3 || ^1.2",
"combination-or-version-range-mixed/03": "1.2.3 || ~1.2.1 || ^1.2",
"combination-or-version-range-mixed/04": "~1.2.3 || 1.2.1 || 1.2.4"
}
}

0 comments on commit fd5c06f

Please sign in to comment.