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)
202
202
$ repoManager = $ this ->composer ->getRepositoryManager ();
203
203
$ newRepos = array ();
204
204
205
- foreach ($ this ->json ['repositories ' ] as $ repoJson ) {
205
+ $ namedIndex = false ;
206
+ foreach ($ this ->json ['repositories ' ] as $ repoKey => $ repoJson ) {
206
207
if (!isset ($ repoJson ['type ' ])) {
207
208
continue ;
208
209
}
@@ -212,14 +213,21 @@ protected function prependRepositories(RootPackageInterface $root)
212
213
$ repoJson
213
214
);
214
215
$ 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
+ }
216
225
}
217
226
218
227
$ 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 );
223
231
}
224
232
225
233
/**
You can’t perform that action at this time.
0 commit comments