diff --git a/src/Console/Style/SymfonyStyleFactory.php b/src/Console/Style/SymfonyStyleFactory.php index 261575652df..694f6397ddb 100644 --- a/src/Console/Style/SymfonyStyleFactory.php +++ b/src/Console/Style/SymfonyStyleFactory.php @@ -40,6 +40,11 @@ public function create(): RectorStyle $consoleOutput->setVerbosity(OutputInterface::VERBOSITY_QUIET); } + // no interactive terminal, e.g. piped output, CI or an agent - never emit ANSI, even if forced via --ansi + if (!defined('STDOUT') || !stream_isatty(STDOUT)) { + $consoleOutput->setDecorated(false); + } + return new RectorStyle($argvInput, $consoleOutput); }