/** * Merge two collections of package links and collect duplicates for * subsequent processing. * * @param string $type 'require' or 'require-dev' * @param array $origin Primary collection * @param array $merge Additional collection * @param PluginState $state * @return array Merged collection */ protected function mergeOrDefer($type, array $origin, array $merge, $state) { $dups = array(); foreach ($merge as $name => $link) { if (!isset($origin[$name]) || $state->replaceDuplicateLinks()) { $this->logger->info("Merging <comment>{$name}</comment>"); $origin[$name] = $link; } else { // Defer to solver. $this->logger->info("Deferring duplicate <comment>{$name}</comment>"); $dups[] = $link; } } $state->addDuplicateLinks($type, $dups); return $origin; }
/** * Merge require-dev into RootPackage * * @param RootPackage $root * @param PluginState $state */ protected function mergeDevRequires(RootPackage $root, PluginState $state) { $requires = $this->package->getDevRequires(); if (empty($requires)) { return; } $this->mergeStabilityFlags($root, $requires); $dups = array(); $root->setDevRequires($this->mergeLinks($root->getDevRequires(), $requires, $state->replaceDuplicateLinks(), $dups)); $state->addDuplicateLinks('require-dev', $dups); }