diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 0d32763a0ff4f..a9c35931f37d9 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -64,7 +64,8 @@ public function block($messages, ?string $type = null, ?string $style = null, st $messages = \is_array($messages) ? array_values($messages) : [$messages]; $this->autoPrependBlock(); - $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape)); + $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape), + self::OUTPUT_NORMAL | ('ERROR' == $type ? self::VERBOSITY_QUIET : 0)); $this->newLine(); } diff --git a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php index 943b94172a609..32adae1acf983 100644 --- a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php +++ b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php @@ -115,4 +115,23 @@ public function testGetErrorStyleUsesTheCurrentOutputIfNoErrorOutputIsAvailable( $this->assertInstanceOf(SymfonyStyle::class, $style->getErrorStyle()); } + + public function testPrintErrorIfWeRunInQuietMode() + { + $output = $this->getMockBuilder(OutputInterface::class)->getMock(); + $output + ->method('getFormatter') + ->willReturn(new OutputFormatter()); + $output + ->expects($this->once()) + ->method('writeln') + ->with( + $this->anything(), + $this->callback(function ($type) { + return (OutputInterface::VERBOSITY_QUIET == ($type & OutputInterface::VERBOSITY_QUIET)) ? true : false; + } + )); + $style = new SymfonyStyle($this->getMockBuilder(InputInterface::class)->getMock(), $output); + $style->error('test'); + } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy