composer / semver

Semantic versioning utilities with the addition of version constraints parsing and checking.
MIT License
3.15k stars 76 forks source link

Sanitize version constraints #108

Closed ScreamingDev closed 3 years ago

ScreamingDev commented 4 years ago

For a script I want to gather lots of constraints but also want to remove redundancy. So far I did not figure out how composer/semver can be used to solve this so maybe it is a new feature.

Examples:

And other types of conjunctions or even more complex scenarios like

~ 7.0 || < 7.5.2 || 6.9.1 || > 7.1 || dev-master which could be the same as 6.9.1 || ~7.0 || dev-master

Seldaek commented 4 years ago

With semver 3, you can do Intervals::compactConstraint - which will reduce it down to the minimum constraint range, but it won't give you any human-readable pretty output like composer constraints, it just outputs ranges using >/< more or less..