This repository was archived by the owner on Feb 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-27
lines changed Expand file tree Collapse file tree 1 file changed +5
-27
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,11 @@ private function configureAliases(array $aliases)
389
389
return ;
390
390
}
391
391
392
- if ($ this ->mergeNewAliasesIntoOriginalOnes ($ aliases )) {
392
+ // Performance optimization. If there are no collisions, then we don't need to recompute loops
393
+ $ intersecting = $ this ->aliases && \array_intersect_key ($ this ->aliases , $ aliases );
394
+ $ this ->aliases = $ this ->aliases ? \array_merge ($ this ->aliases , $ aliases ) : $ aliases ;
395
+
396
+ if ($ intersecting ) {
393
397
$ this ->resolveAliases ($ this ->aliases );
394
398
395
399
return ;
@@ -399,32 +403,6 @@ private function configureAliases(array $aliases)
399
403
$ this ->resolveNewAliasesWithPreviouslyResolvedAliases ($ aliases );
400
404
}
401
405
402
- /**
403
- * @param array $newAliases
404
- *
405
- * @return bool whether any of the aliases got replaced
406
- */
407
- private function mergeNewAliasesIntoOriginalOnes (array $ newAliases )
408
- {
409
- if (empty ($ this ->aliases )) {
410
- $ this ->aliases = $ newAliases ;
411
-
412
- return false ;
413
- }
414
-
415
- $ intersect = false ;
416
-
417
- foreach ($ newAliases as $ name => $ target ) {
418
- if (isset ($ this ->aliases [$ name ])) {
419
- $ intersect = true ;
420
- }
421
-
422
- $ this ->aliases [$ name ] = $ target ;
423
- }
424
-
425
- return $ intersect ;
426
- }
427
-
428
406
/**
429
407
* Add an alias.
430
408
*
You can’t perform that action at this time.
0 commit comments