16
16
use Symfony \Component \Console \Helper \Table ;
17
17
use Symfony \Component \Console \Output \OutputInterface ;
18
18
use Symfony \Component \Console \Style \StyleInterface ;
19
+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
19
20
use Symfony \Component \DependencyInjection \Extension \ExtensionInterface ;
20
21
21
22
/**
@@ -59,7 +60,7 @@ protected function listBundles($output)
59
60
/**
60
61
* @return ExtensionInterface
61
62
*/
62
- protected function findExtension ($ name )
63
+ protected function findExtension ($ name, ContainerBuilder $ container )
63
64
{
64
65
$ bundles = $ this ->initializeBundles ();
65
66
$ minScore = \INF ;
@@ -79,20 +80,18 @@ protected function findExtension($name)
79
80
$ guess = $ bundle ->getName ();
80
81
$ minScore = $ distance ;
81
82
}
83
+ }
82
84
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
+ }
89
88
90
- $ distance = levenshtein ($ name , $ extension ->getAlias ());
89
+ foreach ($ container ->getExtensions () as $ extension ) {
90
+ $ distance = levenshtein ($ name , $ extension ->getAlias ());
91
91
92
- if ($ distance < $ minScore ) {
93
- $ guess = $ extension ->getAlias ();
94
- $ minScore = $ distance ;
95
- }
92
+ if ($ distance < $ minScore ) {
93
+ $ guess = $ extension ->getAlias ();
94
+ $ minScore = $ distance ;
96
95
}
97
96
}
98
97
0 commit comments