function Composer::ensureComposerVersion

Same name in other branches
  1. 9 composer/Composer.php \Drupal\Composer\Composer::ensureComposerVersion()
  2. 8.9.x composer/Composer.php \Drupal\Composer\Composer::ensureComposerVersion()
  3. 10 composer/Composer.php \Drupal\Composer\Composer::ensureComposerVersion()

Ensure that the minimum required version of Composer is running.

Throw an exception if Composer is too old.

1 call to Composer::ensureComposerVersion()
ComposerTest::testEnsureComposerVersion in core/tests/Drupal/Tests/Composer/ComposerTest.php
Verify that Composer::ensureComposerVersion() doesn't break.

File

composer/Composer.php, line 98

Class

Composer
Provides static functions for composer script events.

Namespace

Drupal\Composer

Code

public static function ensureComposerVersion() : void {
    $composerVersion = method_exists(ComposerApp::class, 'getVersion') ? ComposerApp::getVersion() : ComposerApp::VERSION;
    if (Comparator::lessThan($composerVersion, '2.3.6')) {
        throw new \RuntimeException("Drupal core development requires Composer 2.3.6, but Composer {$composerVersion} is installed. Run 'composer self-update'.");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.