composer->getLocker();
if (!$locker->isLocked()) {
$this->io->write(' - Composer lock file does not exist.');
$this->io->write(' - Patches defined in dependencies will not be resolved.');
return;
}
$this->io->write(' - Resolving patches from dependencies.');
$ignored_dependencies = $this->plugin->getConfig('ignore-dependency-patches');
$lockdata = $locker->getLockData();
foreach ($lockdata['packages'] as $p) {
// If we're supposed to skip gathering patches from a dependency, do that.
if (in_array($p['name'], $ignored_dependencies)) {
continue;
}
// Find patches in the composer.json for dependencies.
if (!isset($p['extra']) || !isset($p['extra']['patches'])) {
continue;
}
foreach ($this->findPatchesInJson($p['extra']['patches']) as $package => $patches) {
foreach ($patches as $patch) {
$patch->extra['provenance'] = "dependency:" . $package;
/** @var Patch $patch */
$collection->addPatch($patch);
}
}
// TODO: Also find patches in a configured patches.json for the dependency.
}
}
}