fix PHP version parsing; affects [packagist] #11128
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #11127
Any day we have to touch this code is bad day.
Previously only the
1.0.0-alpha
format workedThis PR updates to allow
1.0.0_alpha
1.0.0alpha
and1.0.0.alpha
which are uncommon but valid.This was slightly less trivial than just allowing more separators because of the no separator case (e.g:
1.0.0alpha
) so I switched to parsing the version string into bits using this regex https://github.com/composer/semver/blob/46d9139568ccb8d9e7cdd4539cab7347568a5e2e/src/VersionParser.php#L39 and stirred this function around a bit to try and make it a bit less hideous. I may or may not have succeeded.