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 +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -520,7 +520,6 @@ public function setShared($name, $flag)
520
520
*
521
521
* @param string[]|Initializer\InitializerInterface[]|callable[] $initializers
522
522
*
523
- * @return void
524
523
*/
525
524
private function resolveInitializer ($ initializer )
526
525
{
@@ -904,15 +903,21 @@ private function validateConfig(array $config)
904
903
*/
905
904
private function doSetAlias ($ alias , $ target )
906
905
{
906
+ // $target is either an alias or something else
907
+ // if it is an alias, resolve it
907
908
$ this ->aliases [$ alias ] =
908
909
isset ($ this ->aliases [$ target ]) ? $ this ->aliases [$ target ] : $ target ;
909
910
911
+ // a self-referencing alias indicates a cycle
910
912
if ($ alias === $ this ->aliases [$ alias ]) {
911
913
throw CyclicAliasException::fromCyclicAlias ($ alias , $ this ->aliases );
912
914
}
913
915
916
+ // finally we have to check if existing incomplete alias definitions
917
+ // exist which can get resolved by the new alias
914
918
if (in_array ($ alias , $ this ->aliases )) {
915
919
$ r = array_intersect ($ this ->aliases , [ $ alias ]);
920
+ // found some, resolve them
916
921
foreach ($ r as $ name => $ service ) {
917
922
$ this ->aliases [$ name ] = $ target ;
918
923
}
You can’t perform that action at this time.
0 commit comments