@@ -726,25 +726,23 @@ private function resolveServices($value, $file, $isParameter = false)
726726 if (\in_array ($ value ->getTag (), ['tagged ' , 'tagged_locator ' ], true )) {
727727 $ forLocator = 'tagged_locator ' === $ value ->getTag ();
728728
729- if (\is_string ($ argument ) && $ argument ) {
730- return new TaggedIteratorArgument ($ argument , null , null , $ forLocator );
731- }
732-
733729 if (\is_array ($ argument ) && isset ($ argument ['tag ' ]) && $ argument ['tag ' ]) {
734730 if ($ diff = array_diff (array_keys ($ argument ), ['tag ' , 'index_by ' , 'default_index_method ' ])) {
735731 throw new InvalidArgumentException (sprintf ('"!%s" tag contains unsupported key "%s"; supported ones are "tag", "index_by" and "default_index_method". ' , $ value ->getTag (), implode ('"", " ' , $ diff )));
736732 }
737733
738734 $ argument = new TaggedIteratorArgument ($ argument ['tag ' ], $ argument ['index_by ' ] ?? null , $ argument ['default_index_method ' ] ?? null , $ forLocator );
735+ } elseif (\is_string ($ argument ) && $ argument ) {
736+ $ argument = new TaggedIteratorArgument ($ argument , null , null , $ forLocator );
737+ } else {
738+ throw new InvalidArgumentException (sprintf ('"!%s" tags only accept a non empty string or an array with a key "tag" in "%s". ' , $ value ->getTag (), $ file ));
739+ }
739740
740- if ($ forLocator ) {
741- $ argument = new ServiceLocatorArgument ($ argument );
742- }
743-
744- return $ argument ;
741+ if ($ forLocator ) {
742+ $ argument = new ServiceLocatorArgument ($ argument );
745743 }
746744
747- throw new InvalidArgumentException ( sprintf ( ' "!%s" tags only accept a non empty string or an array with a key "tag" in "%s". ' , $ value -> getTag (), $ file )) ;
745+ return $ argument ;
748746 }
749747 if ('service ' === $ value ->getTag ()) {
750748 if ($ isParameter ) {
0 commit comments