|
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 |
|
@@ -54,7 +55,7 @@ protected function listBundles(OutputInterface|StyleInterface $output) |
54 | 55 | } |
55 | 56 | } |
56 | 57 |
|
57 | | - protected function findExtension(string $name): ExtensionInterface |
| 58 | + protected function findExtension(string $name, ContainerBuilder $container): ExtensionInterface |
58 | 59 | { |
59 | 60 | $bundles = $this->initializeBundles(); |
60 | 61 | $minScore = \INF; |
@@ -90,20 +91,18 @@ protected function findExtension(string $name): ExtensionInterface |
90 | 91 | $guess = $bundle->getName(); |
91 | 92 | $minScore = $distance; |
92 | 93 | } |
| 94 | + } |
93 | 95 |
|
94 | | - $extension = $bundle->getContainerExtension(); |
95 | | - |
96 | | - if ($extension) { |
97 | | - if ($name === $extension->getAlias()) { |
98 | | - return $extension; |
99 | | - } |
| 96 | + if ($container->hasExtension($name)) { |
| 97 | + return $container->getExtension($name); |
| 98 | + } |
100 | 99 |
|
101 | | - $distance = levenshtein($name, $extension->getAlias()); |
| 100 | + foreach ($container->getExtensions() as $extension) { |
| 101 | + $distance = levenshtein($name, $extension->getAlias()); |
102 | 102 |
|
103 | | - if ($distance < $minScore) { |
104 | | - $guess = $extension->getAlias(); |
105 | | - $minScore = $distance; |
106 | | - } |
| 103 | + if ($distance < $minScore) { |
| 104 | + $guess = $extension->getAlias(); |
| 105 | + $minScore = $distance; |
107 | 106 | } |
108 | 107 | } |
109 | 108 |
|
|
0 commit comments