src/Version.php
public function getNextIncreaseOf(string $stability): self
    {
        switch ($stability) {
            case 'patch':
                if ($this->major > 0 && $this->metaver > 0) {
                    return $this->getIncreaseOfNextPossibleMinorOrMeta();
                }

                return new self($this->major, $this->minor, $this->patch + 1, self::STABILITY_STABLE);

            case 'minor':
                return new self($this->major, $this->minor + 1, 0, self::STABILITY_STABLE);

            case 'major':
                return $this->getIncreaseByMajor();

            case 'alpha':
            case 'beta':
            case 'rc':
                return $this->getIncreaseOfMetaver($stability);

            case 'stable':
                return $this->getIncreaseOfStable();

            case 'next':
                return $this->getIncreaseOfNextPossibleMinorOrMeta();

            default:
                throw new \InvalidArgumentException(
                    sprintf(
                        'Unknown stability "%s", accepts "%s".',
                        $stability,
                        implode('", "', ['alpha', 'beta', 'rc', 'stable', 'major', 'next', 'minor', 'patch'])
                    )
                );
        }
    }
public function getNextIncreaseOf(string $stability): self
    {
        switch ($stability) {
            case 'patch':
                if ($this->major > 0 && $this->metaver > 0) {
                    return $this->getIncreaseOfNextPossibleMinorOrMeta();
                }

                return new self($this->major, $this->minor, $this->patch + 1, self::STABILITY_STABLE);

            case 'minor':
                return new self($this->major, $this->minor + 1, 0, self::STABILITY_STABLE);

            case 'major':
                return $this->getIncreaseByMajor();

            case 'alpha':
            case 'beta':
            case 'rc':
                return $this->getIncreaseOfMetaver($stability);

            case 'stable':
                return $this->getIncreaseOfStable();

            case 'next':
                return $this->getIncreaseOfNextPossibleMinorOrMeta();

            default:
                throw new \InvalidArgumentException(
                    sprintf(
                        'Unknown stability "%s", accepts "%s".',
                        $stability,
                        implode('", "', ['alpha', 'beta', 'rc', 'stable', 'major', 'next', 'minor', 'patch'])
                    )
                );
        }
    }
public function getNextIncreaseOf ( string $ stability ) : self { switch ( $ stability ) { case 'patch' : if ( $ this -> major > 0 && $ this -> metaver > 0 ) { return $ this -> getIncreaseOfNextPossibleMinorOrMeta ( ) ; } return new self ( $ this -> major , $ this -> minor , $ this -> patch + 1 , self :: STABILITY_STABLE ) ; case 'minor' : return new self ( $ this -> major , $ this -> minor + 1 , 0 , self :: STABILITY_STABLE ) ; case 'major' : return $ this -> getIncreaseByMajor ( ) ; case 'alpha' : case 'beta' : case 'rc' : return $ this -> getIncreaseOfMetaver ( $ stability ) ; case 'stable' : return $ this -> getIncreaseOfStable ( ) ; case 'next' : return $ this -> getIncreaseOfNextPossibleMinorOrMeta ( ) ; default : throw new \ InvalidArgumentException ( sprintf ( 'Unknown stability "%s", accepts "%s".' , $ stability , implode ( '", "' , [ 'alpha' , 'beta' , 'rc' , 'stable' , 'major' , 'next' , 'minor' , 'patch' ] ) ) ) ; } }
Returns the increased Version based on the stability.

Note:

* Using 'major' on a beta release produces a stable release for *that* major version.
* Using 'stable' on an existing stable will increase the minor version.
* Using 'patch' on an unstable release increases the metaver instead.

@param string $stability either alpha, beta, rc, stable, major, minor or patch

@return self A new version instance with the changes applied
Returns the increased Version based on the stability .