Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. VersionGuesser.php

function VersionGuesser::getRootVersionFromEnv

File

vendor/composer/composer/src/Composer/Package/Version/VersionGuesser.php, line 437

Class

VersionGuesser
Try to guess the current version number based on different VCS configuration.

Namespace

Composer\Package\Version

Code

public function getRootVersionFromEnv() : string {
    $version = Platform::getEnv('COMPOSER_ROOT_VERSION');
    if (!is_string($version) || $version === '') {
        throw new \RuntimeException('COMPOSER_ROOT_VERSION not set or empty');
    }
    if (Preg::isMatch('{^(\\d+(?:\\.\\d+)*)-dev$}i', $version, $match)) {
        $version = $match[1] . '.x-dev';
    }
    return $version;
}
RSS feed
Powered by Drupal