1616use Symfony \Component \Console \Helper \Table ;
1717use Symfony \Component \Console \Output \OutputInterface ;
1818use Symfony \Component \Console \Style \StyleInterface ;
19+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
1920use Symfony \Component \DependencyInjection \Extension \ExtensionInterface ;
2021
2122/**
@@ -59,7 +60,7 @@ protected function listBundles($output)
5960 /**
6061 * @return ExtensionInterface
6162 */
62- protected function findExtension ($ name )
63+ protected function findExtension ($ name, ContainerBuilder $ container )
6364 {
6465 $ bundles = $ this ->initializeBundles ();
6566 $ minScore = \INF ;
@@ -79,20 +80,18 @@ protected function findExtension($name)
7980 $ guess = $ bundle ->getName ();
8081 $ minScore = $ distance ;
8182 }
83+ }
8284
83- $ extension = $ bundle ->getContainerExtension ();
84-
85- if ($ extension ) {
86- if ($ name === $ extension ->getAlias ()) {
87- return $ extension ;
88- }
85+ if ($ container ->hasExtension ($ name )) {
86+ return $ container ->getExtension ($ name );
87+ }
8988
90- $ distance = levenshtein ($ name , $ extension ->getAlias ());
89+ foreach ($ container ->getExtensions () as $ extension ) {
90+ $ distance = levenshtein ($ name , $ extension ->getAlias ());
9191
92- if ($ distance < $ minScore ) {
93- $ guess = $ extension ->getAlias ();
94- $ minScore = $ distance ;
95- }
92+ if ($ distance < $ minScore ) {
93+ $ guess = $ extension ->getAlias ();
94+ $ minScore = $ distance ;
9695 }
9796 }
9897
0 commit comments