Skip to content

Commit

Permalink
Account for 1.x.x usage too
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden authored and localheinz committed Feb 17, 2024
1 parent c412f5b commit 227bf02
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/Vendor/Composer/VersionConstraintNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ private static function normalizeVersionConstraintSeparators(string $versionCons

private static function replaceWildcardXWithAsterisk(string $versionConstraint): string
{
// '1.x.x' -> '1.*'
$versionConstraint = self::applyRegularExpressionReplacementToVersionsInTurn(
$versionConstraint,
'{^(\d+)\.[xX]\.[xX]$}',
'$1.*',
);

// '1.x' -> '1.*'
$versionConstraint = self::applyRegularExpressionReplacementToVersionsInTurn(
$versionConstraint,
'{^(\d+)\.[xX]$}',
'$1.*',
);

// 'x' -> '*'
return self::applyRegularExpressionReplacementToVersionsInTurn(
$versionConstraint,
'{^[xX]$}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"version-range-wildcard-stable/05-major-minor-patch-trimmed": "~1.2.0",
"version-range-wildcard-stable/06-major-minor-patch-untrimmed": "~1.2.0",
"version-range-wildcard-stable/07-major-minor-patch-lower-x": "~1.2.0",
"version-range-wildcard-stable/08-major-minor-patch-upper-X": "~1.2.0"
"version-range-wildcard-stable/08-major-minor-patch-upper-X": "~1.2.0",
"version-range-wildcard-stable/09-major-minor-patch-lower-x": "^1.0",
"version-range-wildcard-stable/10-major-minor-patch-upper-X": "^1.0",
"version-range-wildcard-stable/11-major-minor-patch-mixed-xX": "^1.0",
"version-range-wildcard-stable/12-major-minor-patch-mixed-Xx": "^1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"version-range-wildcard-stable/05-major-minor-patch-trimmed": "1.2.*",
"version-range-wildcard-stable/06-major-minor-patch-untrimmed": " 1.2.* ",
"version-range-wildcard-stable/07-major-minor-patch-lower-x": "1.2.x",
"version-range-wildcard-stable/08-major-minor-patch-upper-X": "1.2.X"
"version-range-wildcard-stable/08-major-minor-patch-upper-X": "1.2.X",
"version-range-wildcard-stable/09-major-minor-patch-lower-x": "1.x.x",
"version-range-wildcard-stable/10-major-minor-patch-upper-X": "1.X.X",
"version-range-wildcard-stable/11-major-minor-patch-mixed-xX": "1.x.X",
"version-range-wildcard-stable/12-major-minor-patch-mixed-Xx": "1.X.x"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"version-range-wildcard-unstable/05-major-minor-patch-trimmed": "~0.1.0",
"version-range-wildcard-unstable/06-major-minor-patch-untrimmed": "~0.1.0",
"version-range-wildcard-unstable/07-major-minor-patch-lower-x": "~0.1.0",
"version-range-wildcard-unstable/08-major-minor-patch-upper-X": "~0.1.0"
"version-range-wildcard-unstable/08-major-minor-patch-upper-X": "~0.1.0",
"version-range-wildcard-unstable/09-major-minor-patch-lower-x": "^0.0",
"version-range-wildcard-unstable/10-major-minor-patch-upper-X": "^0.0",
"version-range-wildcard-unstable/11-major-minor-patch-mixed-xX": "^0.0",
"version-range-wildcard-unstable/12-major-minor-patch-mixed-Xx": "^0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"version-range-wildcard-unstable/05-major-minor-patch-trimmed": "0.1.*",
"version-range-wildcard-unstable/06-major-minor-patch-untrimmed": " 0.1.* ",
"version-range-wildcard-unstable/07-major-minor-patch-lower-x": "0.1.x",
"version-range-wildcard-unstable/08-major-minor-patch-upper-X": "0.1.X"
"version-range-wildcard-unstable/08-major-minor-patch-upper-X": "0.1.X",
"version-range-wildcard-unstable/09-major-minor-patch-lower-x": "0.x.x",
"version-range-wildcard-unstable/10-major-minor-patch-upper-X": "0.X.X",
"version-range-wildcard-unstable/11-major-minor-patch-mixed-xX": "0.x.X",
"version-range-wildcard-unstable/12-major-minor-patch-mixed-Xx": "0.X.x"
}
}

0 comments on commit 227bf02

Please sign in to comment.