function Composer::ensureComposerVersion

Same name in other branches
  1. 8.9.x composer/Composer.php \Drupal\Composer\Composer::ensureComposerVersion()
  2. 10 composer/Composer.php \Drupal\Composer\Composer::ensureComposerVersion()
  3. 11.x 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, '1.9.0')) {
        throw new \RuntimeException("Drupal core development requires Composer 1.9.0, but Composer {$composerVersion} is installed. Please run 'composer self-update'.");
    }
}

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