composer / semver

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

Add Intervals class to allow checking for subsets and intersections between constraints #97

Closed Seldaek closed 4 years ago

Seldaek commented 4 years ago

Ok all tests passing except one now, which is technically a valid result but not really what I'd like it to return.. @Toflar if you'd like to try and use this latest version in your Composer PR feel free.

Seldaek commented 4 years ago

All tests now passing.

https://github.com/composer/semver/pull/97/commits/5aef5c27d3f30e68651945bf7e2bfb817f9e46df adds a new isIntersectionOf method which could theoretically replace ConstraintInterface::matches() but I doubt it's as efficient so maybe not. We need to test and see. Anyway it was a great experiment as it allowed me to fix a few more edge cases in the intervals generation.

@naderman would be happy to get your opinion on https://github.com/composer/semver/pull/97/commits/67b8bb55c5426b0c3bf9e20e8e69b9972c92f4d6 and https://github.com/composer/semver/pull/97/commits/0b0edb398d272be11774c223dc3e2d030d7898d3 especially

naderman commented 4 years ago

I still think it'd be better to have an actual Interval class rather than these arrays with start/end attributes which essentially act like an untyped object.

Seldaek commented 4 years ago

Fixed all feedback.