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

Breadcrumb

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

function BaseCommand::requireComposer

Retrieves the default Composer\Composer instance or throws

Use this instead of getComposer if you absolutely need an instance

Parameters

bool|null $disablePlugins If null, reads --no-plugins as default:

bool|null $disableScripts If null, reads --no-scripts as default:

Throws

\RuntimeException

14 calls to BaseCommand::requireComposer()
AuditCommand::execute in vendor/composer/composer/src/Composer/Command/AuditCommand.php
Executes the current command.
BaseCommand::getComposer in vendor/composer/composer/src/Composer/Command/BaseCommand.php
BaseDependencyCommand::doExecute in vendor/composer/composer/src/Composer/Command/BaseDependencyCommand.php
Execute the command.
CheckPlatformReqsCommand::execute in vendor/composer/composer/src/Composer/Command/CheckPlatformReqsCommand.php
Executes the current command.
ComposerScaffoldCommand::execute in composer/Plugin/Scaffold/ComposerScaffoldCommand.php
Executes the current command.

... See full list

File

vendor/composer/composer/src/Composer/Command/BaseCommand.php, line 96

Class

BaseCommand
Base class for Composer commands

Namespace

Composer\Command

Code

public function requireComposer(?bool $disablePlugins = null, ?bool $disableScripts = null) : Composer {
    if (null === $this->composer) {
        $application = parent::getApplication();
        if ($application instanceof Application) {
            $this->composer = $application->getComposer(true, $disablePlugins, $disableScripts);
            assert($this->composer instanceof Composer);
        }
        else {
            throw new \RuntimeException('Could not create a Composer\\Composer instance, you must inject ' . 'one if this command is not used with a Composer\\Console\\Application instance');
        }
    }
    return $this->composer;
}

API Navigation

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