File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -78,15 +78,12 @@ public static function setupColors(): void
7878 self ::$ useColors = getenv (self ::COLORS ) !== false
7979 ? (bool ) getenv (self ::COLORS )
8080 : (PHP_SAPI === 'cli ' || PHP_SAPI === 'phpdbg ' )
81- && (!function_exists ('stream_isatty ' ) || stream_isatty (STDOUT )) // PHP >= 7.2
82- && getenv ('NO_COLOR ' ) === false
83- && (defined ('PHP_WINDOWS_VERSION_BUILD ' )
84- ? (function_exists ('sapi_windows_vt100_support ' ) && sapi_windows_vt100_support (STDOUT ))
85- || getenv ('ConEmuANSI ' ) === 'ON ' // ConEmu
86- || getenv ('ANSICON ' ) !== false // ANSICON
87- || getenv ('term ' ) === 'xterm ' // MSYS
88- || getenv ('term ' ) === 'xterm-256color ' // MSYS
89- : (!function_exists ('posix_isatty ' ) || posix_isatty (STDOUT ))); // PHP < 7.2
81+ && getenv ('NO_COLOR ' ) === false // https://no-color.org
82+ && (getenv ('FORCE_COLOR ' )
83+ || (function_exists ('sapi_windows_vt100_support ' )
84+ ? sapi_windows_vt100_support (STDOUT )
85+ : @stream_isatty (STDOUT )) // @ may trigger error 'cannot cast a filtered stream on this system'
86+ );
9087
9188 ob_start (function (string $ s ): string {
9289 return self ::$ useColors ? $ s : Dumper::removeColors ($ s );
You can’t perform that action at this time.
0 commit comments