naneau / semver

PHP Semantic Versioning library
MIT License
73 stars 9 forks source link

Feature: Version::next() #21

Closed davidrjonas closed 9 years ago

davidrjonas commented 9 years ago

Adds a method to Version to get the next logical Version. This was necessary for some automatic tagging we set up in Jenkins and I thought it may be useful to others.

Here are the rules:

For the simple case it merely increments the least significant number (either the patch or pre-release number). To move between significant releases (E.g. 1.0 -> 1.1 or 1.0.0-alpha.5 -> 1.0.0-beta.0) a base version can be given. If the current version is less than the base version then the base will be the next version. If they are equal then the least significant number is incremented. If the current version is ahead of the base the least significant version is incremented from the current version, though if the base is in a pre-release state and the current is not then the version has not been updated with consistency and is considered an error.

naneau commented 9 years ago

I have added a couple small questions/remarks. Seems like a handy addition otherwise.

naneau commented 9 years ago

awesome!