-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add bump method on version #4
Comments
That's not a bad idea. Thinking about having the SemVer objects be immutable: // Bump major by 1
$higherSemver = bump($semver, SemVer::MAJOR);
// bump minor by 4
$higherSemver = bump($semver, SemVer::MINOR, 4); or mutable: $semver->increase(SemVer::MAJOR);
$semver->increase(SemVer::MINOR, 5); |
I'd do the immutable way if there's a need for comparison or anything like that, but prefer the mutable way. |
Immutable. Otherwise you run into stuff like this: <?php
$onePointOne = new SemVer("1.1");
$onePointOne->bump(SemVer::major);
echo $onePointOne;//WTF???
|
Maybe it's an idea to make a mutable one that extends the immutable |
What benefit would that provide? |
To be able to support both |
What is the benefit of a maintaining a mutable implementation? To me it seems it will only result in confusion. |
Well true, most of the time you would definitely want an immutable SemVer. In the current implementation the |
In that case adapting the Parser seems to be a more worthwhile adventure. At least in my opinion 😄. |
It probably needs to be refactored and pass the Version metadata through the constructor for an immutable SemVer. |
does it have support for
->bump(SemVer::MAJOR)
or such?like here https://github.com/vierbergenlars/php-semver/tree/master#functions
https://github.com/vierbergenlars/php-semver/blob/2.x/src/vierbergenlars/SemVer/version.php#L127
The text was updated successfully, but these errors were encountered: