Remove default match from AbstractConfigCommand::findExtension
Previously, findExtension would return the first extension that might not even match the $name parameter.
This commit is contained in:
parent
a4f7fbfa04
commit
b85059a672
@ -48,28 +48,27 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
|
||||
|
||||
protected function findExtension($name)
|
||||
{
|
||||
$extension = null;
|
||||
$bundles = $this->initializeBundles();
|
||||
foreach ($bundles as $bundle) {
|
||||
if ($name === $bundle->getName()) {
|
||||
return $bundle->getContainerExtension();
|
||||
}
|
||||
|
||||
$extension = $bundle->getContainerExtension();
|
||||
|
||||
if ($extension && ($name === $extension->getAlias() || $name === $bundle->getName())) {
|
||||
break;
|
||||
if ($extension && $name === $extension->getAlias()) {
|
||||
return $extension;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$extension) {
|
||||
$message = sprintf('No extension with alias "%s" is enabled', $name);
|
||||
if (preg_match('/Bundle$/', $name)) {
|
||||
if ('Bundle' !== substr($name, -6)) {
|
||||
$message = sprintf('No extensions with configuration available for "%s"', $name);
|
||||
} else {
|
||||
$message = sprintf('No extension with alias "%s" is enabled', $name);
|
||||
}
|
||||
|
||||
throw new \LogicException($message);
|
||||
}
|
||||
|
||||
return $extension;
|
||||
}
|
||||
|
||||
public function validateConfiguration(ExtensionInterface $extension, $configuration)
|
||||
{
|
||||
if (!$configuration) {
|
||||
|
Reference in New Issue
Block a user