public static function ExtraPackage::unwrapIfNeeded in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/wikimedia/composer-merge-plugin/src/Merge/ExtraPackage.php \Wikimedia\Composer\Merge\ExtraPackage::unwrapIfNeeded()
Get a full featured Package from a RootPackageInterface.
In Composer versions before 599ad77 the RootPackageInterface only defines a sub-set of operations needed by composer-merge-plugin and RootAliasPackage only implemented those methods defined by the interface. Most of the unimplemented methods in RootAliasPackage can be worked around because the getter methods that are implemented proxy to the aliased package which we can modify by unwrapping. The exception being modifying the 'conflicts', 'provides' and 'replaces' collections. We have no way to actually modify those collections unfortunately in older versions of Composer.
Parameters
RootPackageInterface $root:
string $method Method needed:
Return value
RootPackageInterface|RootPackage
6 calls to ExtraPackage::unwrapIfNeeded()
- ExtraPackage::addRepositories in vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php - Add a collection of repositories described by the given configuration to the given package and the global repository manager.
- ExtraPackage::mergeAutoload in vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php - Merge autoload or autoload-dev into a RootPackageInterface
- ExtraPackage::mergeExtra in vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php - Merge extra config into a RootPackageInterface
- ExtraPackage::mergePackageLinks in vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php - Merge package links of the given type into a RootPackageInterface
- ExtraPackage::mergeStabilityFlags in vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php - Extract and merge stability flags from the given collection of requires and merge them into a RootPackageInterface
File
- vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php, line 474
Class
- ExtraPackage
- Processing for a composer.json file that will be merged into a RootPackageInterface
Namespace
Wikimedia\Composer\MergeCode
public static function unwrapIfNeeded(RootPackageInterface $root, $method = 'setExtra') {
if ($root instanceof RootAliasPackage && !method_exists($root, $method)) {
// Unwrap and return the aliased RootPackage.
$root = $root
->getAliasOf();
}
return $root;
}