@@ -95,35 +95,28 @@ public function process(ContainerBuilder $container): void
9595 $ appTypes = '' ;
9696
9797 $ anyEnvExtensions = [];
98- foreach ($ container ->getExtensions () as $ alias => $ extension ) {
99- if (!$ configuration = $ this ->getConfiguration ($ extension , $ container )) {
100- continue ;
101- }
102-
103- $ anyEnvExtensions [$ alias ] = $ extension ;
104- $ type = $ this ->camelCase ($ alias ).'Config ' ;
105- $ appTypes .= \sprintf ("\n * @psalm-type %s = %s " , $ type , ArrayShapeGenerator::generate ($ configuration ->getConfigTreeBuilder ()->buildTree ()));
106- }
98+ $ registeredExtensions = $ container ->getExtensions ();
10799 foreach ($ this ->bundlesDefinition as $ bundle => $ envs ) {
108100 if (!is_subclass_of ($ bundle , BundleInterface::class)) {
109101 continue ;
110102 }
111103 if (!$ extension = (new $ bundle ())->getContainerExtension ()) {
112104 continue ;
113105 }
114- if (!$ configuration = $ this ->getConfiguration ($ extension , $ container )) {
115- continue ;
116- }
117106
118107 $ extensionAlias = $ extension ->getAlias ();
119- if (isset ($ anyEnvExtensions [$ extensionAlias ])) {
120- $ extension = $ anyEnvExtensions [$ extensionAlias ];
121- } else {
122- $ anyEnvExtensions [$ extensionAlias ] = $ extension ;
123- $ type = $ this ->camelCase ($ extensionAlias ).'Config ' ;
124- $ appTypes .= \sprintf ("\n * @psalm-type %s = %s " , $ type , ArrayShapeGenerator::generate ($ configuration ->getConfigTreeBuilder ()->buildTree ()));
108+ if (isset ($ registeredExtensions [$ extensionAlias ])) {
109+ $ extension = $ registeredExtensions [$ extensionAlias ];
110+ unset($ registeredExtensions [$ extensionAlias ]);
125111 }
126112
113+ if (!$ configuration = $ this ->getConfiguration ($ extension , $ container )) {
114+ continue ;
115+ }
116+ $ anyEnvExtensions [$ extensionAlias ] = $ extension ;
117+ $ type = $ this ->camelCase ($ extensionAlias ).'Config ' ;
118+ $ appTypes .= \sprintf ("\n * @psalm-type %s = %s " , $ type , ArrayShapeGenerator::generate ($ configuration ->getConfigTreeBuilder ()->buildTree ()));
119+
127120 foreach ($ knownEnvs as $ env ) {
128121 if ($ envs [$ env ] ?? $ envs ['all ' ] ?? false ) {
129122 $ extensionsPerEnv [$ env ][] = $ extension ;
@@ -132,6 +125,14 @@ public function process(ContainerBuilder $container): void
132125 }
133126 }
134127 }
128+ foreach ($ registeredExtensions as $ alias => $ extension ) {
129+ if (!$ configuration = $ this ->getConfiguration ($ extension , $ container )) {
130+ continue ;
131+ }
132+ $ anyEnvExtensions [$ alias ] = $ extension ;
133+ $ type = $ this ->camelCase ($ alias ).'Config ' ;
134+ $ appTypes .= \sprintf ("\n * @psalm-type %s = %s " , $ type , ArrayShapeGenerator::generate ($ configuration ->getConfigTreeBuilder ()->buildTree ()));
135+ }
135136 krsort ($ extensionsPerEnv );
136137
137138 $ r = new \ReflectionClass (AppReference::class);
0 commit comments