Skip to content

Commit 1636b41

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: fixed CS fixed test fixed CS Remove default match from AbstractConfigCommand::findExtension
2 parents cbb18f2 + efed0cb commit 1636b41

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Command/AbstractConfigCommand.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,25 @@ protected function listBundles($output)
4545

4646
protected function findExtension($name)
4747
{
48-
$extension = null;
4948
$bundles = $this->initializeBundles();
5049
foreach ($bundles as $bundle) {
51-
$extension = $bundle->getContainerExtension();
50+
if ($name === $bundle->getName()) {
51+
return $bundle->getContainerExtension();
52+
}
5253

53-
if ($extension && ($name === $extension->getAlias() || $name === $bundle->getName())) {
54-
break;
54+
$extension = $bundle->getContainerExtension();
55+
if ($extension && $name === $extension->getAlias()) {
56+
return $extension;
5557
}
5658
}
5759

58-
if (!$extension) {
60+
if ('Bundle' !== substr($name, -6)) {
61+
$message = sprintf('No extensions with configuration available for "%s"', $name);
62+
} else {
5963
$message = sprintf('No extension with alias "%s" is enabled', $name);
60-
if (preg_match('/Bundle$/', $name)) {
61-
$message = sprintf('No extensions with configuration available for "%s"', $name);
62-
}
63-
64-
throw new \LogicException($message);
6564
}
6665

67-
return $extension;
66+
throw new \LogicException($message);
6867
}
6968

7069
public function validateConfiguration(ExtensionInterface $extension, $configuration)

0 commit comments

Comments
 (0)