Skip to content

Commit 6eaaf28

Browse files
committed
[FrameworkBundle][WebServerBundle] Use SymfonyStyle::getErrorStyle() in commands
1 parent d94da86 commit 6eaaf28

14 files changed

+16
-26
lines changed

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Console\Input\InputInterface;
1717
use Symfony\Component\Console\Input\InputOption;
1818
use Symfony\Component\Console\Output\OutputInterface;
19-
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2019
use Symfony\Component\Console\Style\SymfonyStyle;
2120
use Symfony\Component\Finder\Finder;
2221

@@ -89,8 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8988
$io = new SymfonyStyle($input, $output);
9089

9190
if (null === $twig = $this->getTwigEnvironment()) {
92-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
93-
$errorIo->error('The Twig environment needs to be set.');
91+
$io->getErrorStyle()->error('The Twig environment needs to be set.');
9492

9593
return 1;
9694
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
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\Output\ConsoleOutputInterface;
1918
use Symfony\Component\Console\Style\SymfonyStyle;
2019
use Symfony\Component\Console\Exception\LogicException;
2120
use Symfony\Component\Yaml\Yaml;
@@ -63,7 +62,7 @@ protected function configure()
6362
protected function execute(InputInterface $input, OutputInterface $output)
6463
{
6564
$io = new SymfonyStyle($input, $output);
66-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
65+
$errorIo = $io->getErrorStyle();
6766

6867
if (null === $name = $input->getArgument('name')) {
6968
$this->listBundles($errorIo);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
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\Output\ConsoleOutputInterface;
2120
use Symfony\Component\Console\Style\SymfonyStyle;
2221

2322
/**
@@ -71,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7170
$io = new SymfonyStyle($input, $output);
7271

7372
if (null === $name = $input->getArgument('name')) {
74-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
73+
$errorIo = $io->getErrorStyle();
7574
$this->listBundles($errorIo);
7675
$errorIo->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration. (e.g. <comment>config:dump-reference FrameworkBundle</comment>)');
7776

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Console\Input\InputOption;
1717
use Symfony\Component\Console\Input\InputInterface;
1818
use Symfony\Component\Console\Output\OutputInterface;
19-
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2019
use Symfony\Component\Console\Style\SymfonyStyle;
2120
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2221
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -94,7 +93,7 @@ protected function configure()
9493
protected function execute(InputInterface $input, OutputInterface $output)
9594
{
9695
$io = new SymfonyStyle($input, $output);
97-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
96+
$errorIo = $io->getErrorStyle();
9897

9998
$this->validateInput($input);
10099
$object = $this->getContainerBuilder();

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Console\Input\InputOption;
1717
use Symfony\Component\Console\Input\InputInterface;
1818
use Symfony\Component\Console\Output\OutputInterface;
19-
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2019
use Symfony\Component\Console\Style\SymfonyStyle;
2120
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2221

@@ -66,8 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6665
$options = array();
6766
if ($event = $input->getArgument('event')) {
6867
if (!$dispatcher->hasListeners($event)) {
69-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
70-
$errorIo->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
68+
$io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
7169

7270
return;
7371
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

1414
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
15-
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1615
use Symfony\Component\Console\Style\SymfonyStyle;
1716
use Symfony\Component\Console\Input\InputInterface;
1817
use Symfony\Component\Console\Input\InputArgument;
@@ -160,8 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
160159
$outputMessage .= sprintf(' and domain "%s"', $domain);
161160
}
162161

163-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
164-
$errorIo->warning($outputMessage);
162+
$io->getErrorStyle()->warning($outputMessage);
165163

166164
return;
167165
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

14-
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1514
use Symfony\Component\Console\Style\SymfonyStyle;
1615
use Symfony\Component\Translation\Catalogue\TargetOperation;
1716
use Symfony\Component\Translation\Catalogue\MergeOperation;
@@ -86,7 +85,7 @@ public function isEnabled()
8685
protected function execute(InputInterface $input, OutputInterface $output)
8786
{
8887
$io = new SymfonyStyle($input, $output);
89-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
88+
$errorIo = $io->getErrorStyle();
9089

9190
// check presence of force or dump-message
9291
if ($input->getOption('force') !== true && $input->getOption('dump-messages') !== true) {

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"require-dev": {
3535
"symfony/asset": "~2.8|~3.0",
3636
"symfony/browser-kit": "~2.8|~3.0",
37-
"symfony/console": "~2.8.8|~3.0.8|~3.1.2|~3.2",
37+
"symfony/console": "~3.3",
3838
"symfony/css-selector": "~2.8|~3.0",
3939
"symfony/dom-crawler": "~2.8|~3.0",
4040
"symfony/polyfill-intl-icu": "~1.0",

src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Console\Input\InputArgument;
1616
use Symfony\Component\Console\Input\InputInterface;
1717
use Symfony\Component\Console\Input\InputOption;
18-
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1918
use Symfony\Component\Console\Output\OutputInterface;
2019
use Symfony\Component\Console\Question\Question;
2120
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -86,7 +85,7 @@ protected function configure()
8685
protected function execute(InputInterface $input, OutputInterface $output)
8786
{
8887
$io = new SymfonyStyle($input, $output);
89-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
88+
$errorIo = $io->getErrorStyle();
9089

9190
$input->isInteractive() ? $errorIo->title('Symfony Password Encoder Utility') : $errorIo->newLine();
9291

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"require-dev": {
2626
"symfony/asset": "~2.8|~3.0",
2727
"symfony/browser-kit": "~2.8|~3.0",
28-
"symfony/console": "~2.8|~3.0",
28+
"symfony/console": "~3.3",
2929
"symfony/css-selector": "~2.8|~3.0",
3030
"symfony/dom-crawler": "~2.8|~3.0",
3131
"symfony/form": "~2.8|~3.0",
@@ -44,7 +44,8 @@
4444
"twig/twig": "~1.28|~2.0"
4545
},
4646
"suggest": {
47-
"symfony/security-acl": "For using the ACL functionality of this bundle"
47+
"symfony/security-acl": "For using the ACL functionality of this bundle",
48+
"symfony/console": "For using the console commands"
4849
},
4950
"autoload": {
5051
"psr-4": { "Symfony\\Bundle\\SecurityBundle\\": "" },

0 commit comments

Comments
 (0)