classes/phing/tasks/ext/VersionTask.php
private function getVersion($oldVersion)
    {
        preg_match('#^(?<PREFIX>v)?(?<MAJOR>\d+)?(?:\.(?<MINOR>\d+))?(?:\.(?<BUGFIX>\d+))?#', $oldVersion, $version);

        // Setting values if not captured
        $version['PREFIX'] = $version['PREFIX'] ?? '';
        $version[self::RELEASETYPE_MAJOR] = $version[self::RELEASETYPE_MAJOR] ?? '0';
        $version[self::RELEASETYPE_MINOR] = $version[self::RELEASETYPE_MINOR] ?? '0';
        $version[self::RELEASETYPE_BUGFIX] = $version[self::RELEASETYPE_BUGFIX] ?? '0';

        // Resetting Minor and/or Bugfix number according to release type
        switch ($this->releasetype) {
            case self::RELEASETYPE_MAJOR:
                $version[self::RELEASETYPE_MINOR] = '0';
            // no break
            case self::RELEASETYPE_MINOR:
                $version[self::RELEASETYPE_BUGFIX] = '0';
                break;
        }

        $version[$this->releasetype]++;

        return sprintf(
            '%s%u.%u.%u',
            $version['PREFIX'],
            $version[self::RELEASETYPE_MAJOR],
            $version[self::RELEASETYPE_MINOR],
            $version[self::RELEASETYPE_BUGFIX]
        );
    }
private function getVersion($oldVersion)
    {
        preg_match('#^(?<PREFIX>v)?(?<MAJOR>\d+)?(?:\.(?<MINOR>\d+))?(?:\.(?<BUGFIX>\d+))?#', $oldVersion, $version);

        // Setting values if not captured
        $version['PREFIX'] = $version['PREFIX'] ?? '';
        $version[self::RELEASETYPE_MAJOR] = $version[self::RELEASETYPE_MAJOR] ?? '0';
        $version[self::RELEASETYPE_MINOR] = $version[self::RELEASETYPE_MINOR] ?? '0';
        $version[self::RELEASETYPE_BUGFIX] = $version[self::RELEASETYPE_BUGFIX] ?? '0';

        // Resetting Minor and/or Bugfix number according to release type
        switch ($this->releasetype) {
            case self::RELEASETYPE_MAJOR:
                $version[self::RELEASETYPE_MINOR] = '0';
            // no break
            case self::RELEASETYPE_MINOR:
                $version[self::RELEASETYPE_BUGFIX] = '0';
                break;
        }

        $version[$this->releasetype]++;

        return sprintf(
            '%s%u.%u.%u',
            $version['PREFIX'],
            $version[self::RELEASETYPE_MAJOR],
            $version[self::RELEASETYPE_MINOR],
            $version[self::RELEASETYPE_BUGFIX]
        );
    }
private function getVersion ( $ oldVersion ) { preg_match ( '#^(?<PREFIX>v)?(?<MAJOR>\d+)?(?:\.(?<MINOR>\d+))?(?:\.(?<BUGFIX>\d+))?#' , $ oldVersion , $ version ) ; // Setting values if not captured $ version [ 'PREFIX' ] = $ version [ 'PREFIX' ] ?? '' ; $ version [ self :: RELEASETYPE_MAJOR ] = $ version [ self :: RELEASETYPE_MAJOR ] ?? '0' ; $ version [ self :: RELEASETYPE_MINOR ] = $ version [ self :: RELEASETYPE_MINOR ] ?? '0' ; $ version [ self :: RELEASETYPE_BUGFIX ] = $ version [ self :: RELEASETYPE_BUGFIX ] ?? '0' ; // Resetting Minor and/or Bugfix number according to release type switch ( $ this -> releasetype ) { case self :: RELEASETYPE_MAJOR : $ version [ self :: RELEASETYPE_MINOR ] = '0' ; // no break case self :: RELEASETYPE_MINOR : $ version [ self :: RELEASETYPE_BUGFIX ] = '0' ; break ; } $ version [ $ this -> releasetype ] ++ ; return sprintf ( '%s%u.%u.%u' , $ version [ 'PREFIX' ] , $ version [ self :: RELEASETYPE_MAJOR ] , $ version [ self :: RELEASETYPE_MINOR ] , $ version [ self :: RELEASETYPE_BUGFIX ] ) ; }
Returns new version number corresponding to Release type

@param  string $oldVersion
@return string
Returns new version number corresponding to Release type