Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b327f5

Browse files
committed
[FrameworkBundle] Use getErrorStyle() when relevant
1 parent 2bf68f6 commit 1b327f5

6 files changed

+6
-13
lines changed

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
/**
@@ -74,7 +73,7 @@ protected function configure()
7473
protected function execute(InputInterface $input, OutputInterface $output)
7574
{
7675
$io = new SymfonyStyle($input, $output);
77-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
76+
$errorIo = $io->getErrorStyle();
7877

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

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;
@@ -95,7 +94,7 @@ protected function configure()
9594
protected function execute(InputInterface $input, OutputInterface $output)
9695
{
9796
$io = new SymfonyStyle($input, $output);
98-
$errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io;
97+
$errorIo = $io->getErrorStyle();
9998

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6666
$options = array();
6767
if ($event = $input->getArgument('event')) {
6868
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));
69+
$io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
7170

7271
return;
7372
}

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) {

0 commit comments

Comments
 (0)