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

Breadcrumb

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

function PackageDiscoveryTrait::getMinimumStability

Return value

key-of<BasePackage::STABILITIES>

2 calls to PackageDiscoveryTrait::getMinimumStability()
PackageDiscoveryTrait::findBestVersionAndNameForPackage in vendor/composer/composer/src/Composer/Command/PackageDiscoveryTrait.php
Given a package name, this determines the best version to use in the require key.
PackageDiscoveryTrait::getRepositorySet in vendor/composer/composer/src/Composer/Command/PackageDiscoveryTrait.php

File

vendor/composer/composer/src/Composer/Command/PackageDiscoveryTrait.php, line 74

Class

PackageDiscoveryTrait
@internal

Namespace

Composer\Command

Code

private function getMinimumStability(InputInterface $input) : string {
    if ($input->hasOption('stability')) {
        // @phpstan-ignore-line as InitCommand does have this option but not all classes using this trait do
        return VersionParser::normalizeStability($input->getOption('stability') ?? 'stable');
    }
    // @phpstan-ignore-next-line as RequireCommand does not have the option above so this code is reachable there
    $file = Factory::getComposerFile();
    if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode((string) file_get_contents($file), true))) {
        if (isset($composer['minimum-stability'])) {
            return VersionParser::normalizeStability($composer['minimum-stability']);
        }
    }
    return 'stable';
}

API Navigation

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