10000 [FrameworkBundle] Applied new styles to the config:debug & config:dum… · xabbuh/symfony@e56a619 · GitHub
[go: up one dir, main page]

Skip to content

Commit e56a619

Browse files
committed
[FrameworkBundle] Applied new styles to the config:debug & config:dump-reference commands
1 parent e60f715 commit e56a619

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Config\Definition\ConfigurationInterface;
1515
use Symfony\Component\Console\Helper\Table;
1616
use Symfony\Component\Console\Output\OutputInterface;
17+
use Symfony\Component\Console\Style\StyleInterface;
1718
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
1819

1920
/**
@@ -27,24 +28,21 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
2728
{
2829
protected function listBundles(OutputInterface $output)
2930
{
30-
$output->writeln('Available registered bundles with their extension alias if available:');
31-
32-
if (class_exists('Symfony\Component\Console\Helper\Table')) {
33-
$table = new Table($output);
34-
} else {
35-
$table = $this->getHelperSet()->get('table');
36-
}
37-
38-
$table->setHeaders(array('Bundle name', 'Extension alias'));
31+
$headers = array('Bundle name', 'Extension alias');
32+
$rows = array();
3933
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
4034
$extension = $bundle->getContainerExtension();
41-
$table->addRow(array($bundle->getName(), $extension ? $extension->getAlias() : ''));
35+
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
4236
}
4337

44-
if (class_exists('Symfony\Component\Console\Helper\Table')) {
45-
$table->render();
38+
$message = 'Available registered bundles with their extension alias if available:';
39+
if ($output instanceof StyleInterface) {
40+
$output->writeln(' '.$message);
41+
$output->table($headers, $rows);
4642
} else {
47-
$table->render($output);
43+
$output->writeln($message);
44+
$table = new Table($output);
45+
$table->setHeaders($headers)->setRows($rows)->render($output);
4846
}
4947
}
5048

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Console\Input\InputArgument;
1616
use Symfony\Component\Console\Input\InputInterface;
1717
use Symfony\Component\Console\Output\OutputInterface;
18+
use Symfony\Component\Console\Style\SymfonyStyle;
1819
use Symfony\Component\Yaml\Yaml;
1920

2021
/**
@@ -57,8 +58,9 @@ protected function configure()
5758
*/
5859
protected function execute(InputInterface $input, OutputInterface $output)
5960
{
61+
$output = new SymfonyStyle($input, $output);
6062
if (false !== strpos($input->getFirstArgument(), ':d')) {
61-
$output->writeln('<comment>The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.</comment>');
63+
$output->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.');
6264
}
6365

6466
$name = $input->getArgument('name');

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Console\Input\InputOption;
1818
use Symfony\Component\Console\Input\InputInterface;
1919
use Symfony\Component\Console\Output\OutputInterface;
20+
use Symfony\Component\Console\Style\SymfonyStyle;
2021

2122
/**
2223
* A console command for dumping available configuration reference.
@@ -66,6 +67,7 @@ protected function configure()
6667
*/
6768
protected function execute(InputInterface $input, OutputInterface $output)
6869
{
70+
$output = new SymfonyStyle($input, $output);
6971
$name = $input->getArgument('name');
7072

7173
if (empty($name)) {

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"require-dev": {
3636
"symfony/phpunit-bridge": "~2.7",
3737
"symfony/browser-kit": "~2.4",
38-
"symfony/console": "~2.6",
38+
"symfony/console": "~2.7",
3939
"symfony/css-selector": "~2.0,>=2.0.5",
4040
"symfony/dom-crawler": "~2.0,>=2.0.5",
4141
"symfony/finder": "~2.0,>=2.0.5",

0 commit comments

Comments
 (0)
0