|
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\ConfigurationExtensionInterface; |
20 | 21 | use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; |
21 | 22 |
|
@@ -60,7 +61,7 @@ protected function listBundles($output) |
60 | 61 | /** |
61 | 62 | * @return ExtensionInterface |
62 | 63 | */ |
63 | | - protected function findExtension(string $name) |
| 64 | + protected function findExtension(string $name, ContainerBuilder $container) |
64 | 65 | { |
65 | 66 | $bundles = $this->initializeBundles(); |
66 | 67 | $minScore = \INF; |
@@ -96,20 +97,18 @@ protected function findExtension(string $name) |
96 | 97 | $guess = $bundle->getName(); |
97 | 98 | $minScore = $distance; |
98 | 99 | } |
| 100 | + } |
99 | 101 |
|
100 | | - $extension = $bundle->getContainerExtension(); |
101 | | - |
102 | | - if ($extension) { |
103 | | - if ($name === $extension->getAlias()) { |
104 | | - return $extension; |
105 | | - } |
| 102 | + if ($container->hasExtension($name)) { |
| 103 | + return $container->getExtension($name); |
| 104 | + } |
106 | 105 |
|
107 | | - $distance = levenshtein($name, $extension->getAlias()); |
| 106 | + foreach ($container->getExtensions() as $extension) { |
| 107 | + $distance = levenshtein($name, $extension->getAlias()); |
108 | 108 |
|
109 | | - if ($distance < $minScore) { |
110 | | - $guess = $extension->getAlias(); |
111 | | - $minScore = $distance; |
112 | | - } |
| 109 | + if ($distance < $minScore) { |
| 110 | + $guess = $extension->getAlias(); |
| 111 | + $minScore = $distance; |
113 | 112 | } |
114 | 113 | } |
115 | 114 |
|
|
0 commit comments