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.
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ BaseCommand.php, line 96
Class
- BaseCommand
- Base class for Composer commands
Namespace
Composer\CommandCode
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;
}