<?php
/**
* Increment the version number
* @param string $what One of 'major', 'minor', 'patch' or 'build'
* @return \vierbergenlars\SemVer\version
* @throws SemVerException When an invalid increment value is given
*/
public function inc($what)
{
if ($what == 'major') {
return new version(($this->major + 1) . '.0.0');
}
if ($what == 'minor') {
return new version($this->major . '.' . ($this->minor + 1) . '.0');
}
if ($what == 'patch') {
return new version($this->major . '.' . $this->minor . '.' . ($this->patch + 1));
}
if ($what == 'build') {
if ($this->build == -1) {
return new version($this->major . '.' . $this->minor . '.' . $this->patch . '-1');
}
return new version($this->major . '.' . $this->minor . '.' . $this->patch . '-' . ($this->build + 1));
}
throw new SemVerException('Invalid increment value given', $what);
}
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