File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,8 @@ protected function prependRepositories(RootPackageInterface $root)
202202 $ repoManager = $ this ->composer ->getRepositoryManager ();
203203 $ newRepos = array ();
204204
205- foreach ($ this ->json ['repositories ' ] as $ repoJson ) {
205+ $ namedIndex = false ;
206+ foreach ($ this ->json ['repositories ' ] as $ repoKey => $ repoJson ) {
206207 if (!isset ($ repoJson ['type ' ])) {
207208 continue ;
208209 }
@@ -212,14 +213,21 @@ protected function prependRepositories(RootPackageInterface $root)
212213 $ repoJson
213214 );
214215 $ repoManager ->prependRepository ($ repo );
215- $ newRepos [] = $ repo ;
216+
217+ if (is_numeric ($ repoKey )) {
218+ $ newRepos [] = $ repo ;
219+ }
220+ else {
221+ // Indexed repository name.
222+ $ newRepos [$ repoKey ] = $ repo ;
223+ $ namedIndex = true ;
224+ }
216225 }
217226
218227 $ unwrapped = self ::unwrapIfNeeded ($ root , 'setRepositories ' );
219- $ unwrapped ->setRepositories (array_merge (
220- $ newRepos ,
221- $ root ->getRepositories ()
222- ));
228+ $ repositories = $ root ->getRepositories ();
229+ $ repositories = $ namedIndex ? ($ newRepos + $ repositories ) : array_merge ($ newRepos , $ repositories );
230+ $ unwrapped ->setRepositories ($ repositories );
223231 }
224232
225233 /**
You can’t perform that action at this time.
0 commit comments