AssetsVersionManager.php
public function incrementVersion($delta = 1, $rereadFile = false)
    {
        if ($rereadFile) {
            $this->readFile();
        }

        if (!is_numeric($delta) || round($delta) != $delta) {
            throw new \InvalidArgumentException(sprintf(
                    'Delta must be integer, %s given',
                    var_export($delta, true)
                ));
        }

        preg_match('/^(.*)(\d+)$/U', $this->versionValue, $matches);
        if (!array_key_exists(2, $matches)) {
            throw new \UnexpectedValueException(sprintf(
                    'Could not increment assets version %s - it should be integer or at least have integer ending',
                    var_export($this->versionValue, true)
                ));
        }

        $newValue = max(0, $matches[2] + $delta) . '';

        // Preserve leading zeros
        if ($matches[2][0] == '0') {
            $newValue = str_pad($newValue, strlen($matches[2]), '0', STR_PAD_LEFT);
        }

        $this->setVersion($matches[1] . $newValue);
    }
public function incrementVersion($delta = 1, $rereadFile = false)
    {
        if ($rereadFile) {
            $this->readFile();
        }

        if (!is_numeric($delta) || round($delta) != $delta) {
            throw new \InvalidArgumentException(sprintf(
                    'Delta must be integer, %s given',
                    var_export($delta, true)
                ));
        }

        preg_match('/^(.*)(\d+)$/U', $this->versionValue, $matches);
        if (!array_key_exists(2, $matches)) {
            throw new \UnexpectedValueException(sprintf(
                    'Could not increment assets version %s - it should be integer or at least have integer ending',
                    var_export($this->versionValue, true)
                ));
        }

        $newValue = max(0, $matches[2] + $delta) . '';

        // Preserve leading zeros
        if ($matches[2][0] == '0') {
            $newValue = str_pad($newValue, strlen($matches[2]), '0', STR_PAD_LEFT);
        }

        $this->setVersion($matches[1] . $newValue);
    }
Increments value for assets version found in parameters file
Only works when current value is integer or has integer ending, e.g. v42
If delta is given, incrementing is done by that value.

@param int $delta number to increment (default is 1)
@param boolean $rereadFile if true, re-reads the file first