You are here

public function MergePlugin::onDependencySolve in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php \Wikimedia\Composer\MergePlugin::onDependencySolve()

Handle an event callback for pre-dependency solving phase of an install or update by adding any duplicate package dependencies found during initial merge processing to the request that will be processed by the dependency solver.

Parameters

InstallerEvent $event:

File

vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php, line 224

Class

MergePlugin
Composer plugin that allows merging multiple composer.json files.

Namespace

Wikimedia\Composer

Code

public function onDependencySolve(InstallerEvent $event) {
  $request = $event
    ->getRequest();
  foreach ($this->state
    ->getDuplicateLinks('require') as $link) {
    $this->logger
      ->info("Adding dependency <comment>{$link}</comment>");
    $request
      ->install($link
      ->getTarget(), $link
      ->getConstraint());
  }
  if ($this->state
    ->isDevMode()) {
    foreach ($this->state
      ->getDuplicateLinks('require-dev') as $link) {
      $this->logger
        ->info("Adding dev dependency <comment>{$link}</comment>");
      $request
        ->install($link
        ->getTarget(), $link
        ->getConstraint());
    }
  }
}