From 649087d6de158dc4da73a06c7759dec5932be5a5 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 4 May 2021 16:47:54 +0200 Subject: [PATCH] Fix type issues with root package interface --- src/Composer/Command/UpdateCommand.php | 5 +-- src/Composer/Package/RootAliasPackage.php | 40 +++++++++++++++++++ src/Composer/Package/RootPackage.php | 24 +++-------- src/Composer/Package/RootPackageInterface.php | 35 ++++++++++++++++ 4 files changed, 82 insertions(+), 22 deletions(-) diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php index f09d73a1c..92d78be7b 100644 --- a/src/Composer/Command/UpdateCommand.php +++ b/src/Composer/Command/UpdateCommand.php @@ -17,7 +17,6 @@ use Composer\DependencyResolver\Request; use Composer\Installer; use Composer\IO\IOInterface; use Composer\Package\Loader\RootPackageLoader; -use Composer\Package\RootPackage; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; use Composer\Package\Version\VersionParser; @@ -156,9 +155,7 @@ EOT } $rootPackage->setRequires($rootRequires); $rootPackage->setDevRequires($rootDevRequires); - if ($rootPackage instanceof RootPackage) { - $rootPackage->setReferences(RootPackageLoader::extractReferences($reqs, $rootPackage->getReferences())); - } + $rootPackage->setReferences(RootPackageLoader::extractReferences($reqs, $rootPackage->getReferences())); $rootPackage->setStabilityFlags(RootPackageLoader::extractStabilityFlags($reqs, $rootPackage->getMinimumStability(), $rootPackage->getStabilityFlags())); if ($input->getOption('interactive')) { diff --git a/src/Composer/Package/RootAliasPackage.php b/src/Composer/Package/RootAliasPackage.php index 836a9ce3d..c6c8c1847 100644 --- a/src/Composer/Package/RootAliasPackage.php +++ b/src/Composer/Package/RootAliasPackage.php @@ -159,6 +159,46 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf $this->aliasOf->setStabilityFlags($stabilityFlags); } + /** + * {@inheritDoc} + */ + public function setMinimumStability($minimumStability) + { + $this->aliasOf->setMinimumStability($minimumStability); + } + + /** + * {@inheritDoc} + */ + public function setPreferStable($preferStable) + { + $this->aliasOf->setPreferStable($preferStable); + } + + /** + * {@inheritDoc} + */ + public function setConfig(array $config) + { + $this->aliasOf->setConfig($config); + } + + /** + * {@inheritDoc} + */ + public function setReferences(array $references) + { + $this->aliasOf->setReferences($references); + } + + /** + * {@inheritDoc} + */ + public function setAliases(array $aliases) + { + $this->aliasOf->setAliases($aliases); + } + /** * {@inheritDoc} */ diff --git a/src/Composer/Package/RootPackage.php b/src/Composer/Package/RootPackage.php index 7850cfba7..945bfd17e 100644 --- a/src/Composer/Package/RootPackage.php +++ b/src/Composer/Package/RootPackage.php @@ -29,9 +29,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface protected $aliases = array(); /** - * Set the minimumStability - * - * @param string $minimumStability + * {@inerhitDoc} */ public function setMinimumStability($minimumStability) { @@ -47,9 +45,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface } /** - * Set the stabilityFlags - * - * @param array $stabilityFlags + * {@inheritDoc} */ public function setStabilityFlags(array $stabilityFlags) { @@ -65,9 +61,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface } /** - * Set the preferStable - * - * @param bool $preferStable + * {@inerhitDoc} */ public function setPreferStable($preferStable) { @@ -83,9 +77,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface } /** - * Set the config - * - * @param array $config + * {@inerhitDoc} */ public function setConfig(array $config) { @@ -101,9 +93,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface } /** - * Set the references - * - * @param array $references + * {@inerhitDoc} */ public function setReferences(array $references) { @@ -119,9 +109,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface } /** - * Set the aliases - * - * @param array $aliases + * {@inerhitDoc} */ public function setAliases(array $aliases) { diff --git a/src/Composer/Package/RootPackageInterface.php b/src/Composer/Package/RootPackageInterface.php index 3d891eab2..ecd72e444 100644 --- a/src/Composer/Package/RootPackageInterface.php +++ b/src/Composer/Package/RootPackageInterface.php @@ -128,6 +128,41 @@ interface RootPackageInterface extends CompletePackageInterface */ public function setStabilityFlags(array $stabilityFlags); + /** + * Set the minimumStability + * + * @param string $minimumStability + */ + public function setMinimumStability($minimumStability); + + /** + * Set the preferStable + * + * @param bool $preferStable + */ + public function setPreferStable($preferStable); + + /** + * Set the config + * + * @param array $config + */ + public function setConfig(array $config); + + /** + * Set the references + * + * @param array $references + */ + public function setReferences(array $references); + + /** + * Set the aliases + * + * @param array $aliases + */ + public function setAliases(array $aliases); + /** * Set the suggested packages *