@@ -69,17 +69,10 @@ public static function config(array $config): array
6969
7070 private const ROUTES_TYPES_TEMPLATE = <<<'PHPDOC'
7171
72- * @psalm-type RoutesConfig = array{{SHAPE}
73- * ...<string, RouteConfig|ImportConfig|AliasConfig>
74- * }
72+ * @psalm-type RoutesConfig = array<string, RouteConfig|ImportConfig|AliasConfig|array<string, RouteConfig|ImportConfig|AliasConfig>>
7573 */
7674 PHPDOC;
7775
78- private const WHEN_ENV_ROUTES_TEMPLATE = <<<'PHPDOC'
79-
80- * "when@{ENV}"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
81- PHPDOC;
82-
8376 public function __construct (
8477 private string $ referenceFile ,
8578 private array $ bundlesDefinition ,
@@ -145,19 +138,11 @@ public function process(ContainerBuilder $container): void
145138 if (false === $ i = strpos ($ phpdoc = $ r ->getDocComment (), "\n * @psalm-type RoutesConfig = " )) {
146139 throw new \LogicException (\sprintf ('Cannot insert config shape in "%s". ' , RoutesReference::class));
147140 }
148- $ routesTypes = '' ;
149- foreach ($ knownEnvs as $ env ) {
150- $ routesTypes .= strtr (self ::WHEN_ENV_ROUTES_TEMPLATE , ['{ENV} ' => $ env ]);
151- }
152- if ('' !== $ routesTypes ) {
153- $ routesTypes = strtr (self ::ROUTES_TYPES_TEMPLATE , ['{SHAPE} ' => $ routesTypes ]);
154- $ routesTypes = substr_replace ($ phpdoc , $ routesTypes , $ i );
155- }
156141
157142 $ configReference = strtr (self ::REFERENCE_TEMPLATE , [
158143 '{APP_TYPES} ' => $ appTypes ,
159144 '{APP_PARAM} ' => $ appParam ,
160- '{ROUTES_TYPES} ' => $ routesTypes ,
145+ '{ROUTES_TYPES} ' => substr_replace ( $ phpdoc , self :: ROUTES_TYPES_TEMPLATE , $ i ) ,
161146 '{ROUTES_PARAM} ' => $ r ->getMethod ('config ' )->getDocComment (),
162147 ]);
163148
0 commit comments