1616use Composer \DependencyResolver \Request ;
1717use Composer \Installer ;
1818use Composer \IO \IOInterface ;
19+ use Composer \Package \Loader \RootPackageLoader ;
1920use Composer \Plugin \CommandEvent ;
2021use Composer \Plugin \PluginEvents ;
2122use Composer \Package \Version \VersionParser ;
@@ -139,8 +140,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
139140 }
140141 }
141142
142- $ rootRequires = $ composer ->getPackage ()->getRequires ();
143- $ rootDevRequires = $ composer ->getPackage ()->getDevRequires ();
143+ $ rootPackage = $ composer ->getPackage ();
144+ $ rootRequires = $ rootPackage ->getRequires ();
145+ $ rootDevRequires = $ rootPackage ->getDevRequires ();
144146 foreach ($ reqs as $ package => $ constraint ) {
145147 if (isset ($ rootRequires [$ package ])) {
146148 $ rootRequires [$ package ] = $ this ->appendConstraintToLink ($ rootRequires [$ package ], $ constraint );
@@ -150,8 +152,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
150152 throw new \UnexpectedValueException ('Only root package requirements can receive temporary constraints and ' .$ package .' is not one ' );
151153 }
152154 }
153- $ composer ->getPackage ()->setRequires ($ rootRequires );
154- $ composer ->getPackage ()->setDevRequires ($ rootDevRequires );
155+ $ rootPackage ->setRequires ($ rootRequires );
156+ $ rootPackage ->setDevRequires ($ rootDevRequires );
157+ $ rootPackage ->setReferences (RootPackageLoader::extractReferences ($ reqs , $ rootPackage ->getReferences ()));
158+ $ rootPackage ->setStabilityFlags (RootPackageLoader::extractStabilityFlags ($ reqs , $ rootPackage ->getMinimumStability (), $ rootPackage ->getStabilityFlags ()));
155159
156160 if ($ input ->getOption ('interactive ' )) {
157161 $ packages = $ this ->getPackagesInteractively ($ io , $ input , $ output , $ composer , $ packages );
0 commit comments