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

Breadcrumb

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

function VersionParser::parseStability

Returns the stability of a version.

@phpstan-return 'stable'|'RC'|'beta'|'alpha'|'dev'

Parameters

string $version:

Return value

string

6 calls to VersionParser::parseStability()
ComponentGenerator::getPackage in composer/Generator/ComponentGenerator.php
Reconcile component dependencies with core.
Composer::setTemplateProjectStability in composer/Composer.php
Set the stability of the template projects to match the Drupal version.
ComposerMinimumStabilityValidator::validate in core/modules/package_manager/src/Validator/ComposerMinimumStabilityValidator.php
Validates composer minimum stability.
GenerateTheme::getStarterKitVersion in core/lib/Drupal/Core/Command/GenerateTheme.php
ProjectCoreCompatibility::getPossibleCoreUpdateVersions in core/modules/update/src/ProjectCoreCompatibility.php
Gets the core versions that should be considered for compatibility ranges.

... See full list

File

vendor/composer/semver/src/VersionParser.php, line 52

Class

VersionParser
Version parser.

Namespace

Composer\Semver

Code

public static function parseStability($version) {
    $version = (string) preg_replace('{#.+$}', '', (string) $version);
    if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
        return 'dev';
    }
    preg_match('{' . self::$modifierRegex . '(?:\\+.*)?$}i', strtolower($version), $match);
    if (!empty($match[3])) {
        return 'dev';
    }
    if (!empty($match[1])) {
        if ('beta' === $match[1] || 'b' === $match[1]) {
            return 'beta';
        }
        if ('alpha' === $match[1] || 'a' === $match[1]) {
            return 'alpha';
        }
        if ('rc' === $match[1]) {
            return 'RC';
        }
    }
    return 'stable';
}

API Navigation

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