You are here

public static function Composer::ensureComposerVersion in Drupal 9

Same name and namespace in other branches
  1. 8 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 90

Class

Composer
Provides static functions for composer script events. See also core/lib/Drupal/Composer/Composer.php, which contains similar scripts needed by projects that include drupal/core. Scripts that are only needed by drupal/drupal go here.

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'.");
  }
}