You are here

public static function Composer::ensureComposerVersion in Drupal 10

Same name and namespace in other branches
  1. 8 composer/Composer.php \Drupal\Composer\Composer::ensureComposerVersion()
  2. 9 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 91

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, '2.3.6')) {
    throw new \RuntimeException("Drupal core development requires Composer 2.3.6, but Composer {$composerVersion} is installed. Please run 'composer self-update'.");
  }
}