composer / semver

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

Collapse contiguous constraints when possible #33

Closed Seldaek closed 8 years ago

Seldaek commented 8 years ago

This only handles simple X.Y || X+1.0 cases right now, but I think it's the most common and helpful. X.Y || X+1.0 || X+2.0 might be relevant but not sure it's worth the extra parsing time, especially considering building something compatible with 3 different major versions is kinda unlikely, most people would drop X.Y eventually along the way.

stof commented 8 years ago

The code of the condition is kinda hard to read, but this looks good to me

Seldaek commented 8 years ago

Yup I know it's ugly as hell but it's the best way to make it exit the condition ASAP and save some cycles. I didn't want the parsing to take more time than it saves in checking for constraints ;)

TBH it doesn't seem to have a huge impact anyway but I didn't measure it in very good conditions here.