From b852c3f3908b4ee1bd5df4140ad28f80f854c76c Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 4 Sep 2026 01:03:51 +0200 Subject: [PATCH 1/2] [Console] Never emit ANSI when output is not a TTY, even with --ansi --- src/Console/Style/SymfonyStyleFactory.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Console/Style/SymfonyStyleFactory.php b/src/Console/Style/SymfonyStyleFactory.php index 261575652df..a920c1b5c66 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); } From 2c738ff20046ddad59aa145fa19f079b4463ebce Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 3 Sep 2026 23:05:49 +0000 Subject: [PATCH 2/2] [ci-review] Rector Rectify --- src/Console/Style/SymfonyStyleFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Style/SymfonyStyleFactory.php b/src/Console/Style/SymfonyStyleFactory.php index a920c1b5c66..694f6397ddb 100644 --- a/src/Console/Style/SymfonyStyleFactory.php +++ b/src/Console/Style/SymfonyStyleFactory.php @@ -41,7 +41,7 @@ public function create(): RectorStyle } // 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))) { + if (!defined('STDOUT') || !stream_isatty(STDOUT)) { $consoleOutput->setDecorated(false); }