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

Breadcrumb

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

function Version::ensureVersionStringIsValid

Parameters

string $version:

Throws

InvalidVersionException

1 call to Version::ensureVersionStringIsValid()
Version::__construct in vendor/phar-io/version/src/Version.php

File

vendor/phar-io/version/src/Version.php, line 182

Class

Version

Namespace

PharIo\Version

Code

private function ensureVersionStringIsValid($version) : void {
    $regex = '/^v?
            (?P<Major>0|[1-9]\\d*)
            \\.
            (?P<Minor>0|[1-9]\\d*)
            (\\.
                (?P<Patch>0|[1-9]\\d*)
            )?
            (?:
                -
                (?<PreReleaseSuffix>(?:(dev|beta|b|rc|alpha|a|patch|p|pl)\\.?\\d*))
            )?
            (?:
                \\+
                (?P<BuildMetadata>[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-@]+)*)
            )?
        $/xi';
    if (\preg_match($regex, $version, $matches) !== 1) {
        throw new InvalidVersionException(\sprintf("Version string '%s' does not follow SemVer semantics", $version));
    }
    $this->parseVersion($matches);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal