Helper/Vcl.php
public function getNextVersion(array $versions)
    {
        if (isset(end($versions)->number)) {
            return (int) end($versions)->number + 1;
        }

        throw new LocalizedException(__('Error fetching next version.'));
    }
public function getNextVersion(array $versions)
    {
        if (isset(end($versions)->number)) {
            return (int) end($versions)->number + 1;
        }

        throw new LocalizedException(__('Error fetching next version.'));
    }
Fetch next version

@param array $versions
@return int
@throws LocalizedException