fix: php: semver parsing fix trim

trim did not work correctly for version ranges:
5.0 - 5.8
5.0 - 5.8 | 6.* | ^7.1
This commit is contained in:
Martin Toman 2022-09-05 10:34:50 -07:00
parent 565ae93893
commit 55d2536e4c

View File

@ -50,12 +50,12 @@
cleanConstraint
);
splitAlternatives = v: let
splitAlternatives = v: (let
# handle version alternatives: ^1.2 || ^2.0
trim = s: l.head (l.match "^[[:space:]]*([^[:space:]]*)[[:space:]]*$" s);
trim = s: l.head (l.match "^[[:space:]]*(.*[^[:space:]])[[:space:]]*$" s);
clean = l.replaceStrings ["||"] ["|"] v;
in
map trim (l.splitString "|" clean);
map trim (l.splitString "|" clean));
in {
# 1.0.2 ~1.0.1
# matching a version with semver