Skip to content

Commit ee553bc

Browse files
feature #57777 [VarDumper] Add support for FORCE_COLOR environment variable (artshade)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [VarDumper] Add support for `FORCE_COLOR` environment variable | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | | License | MIT Commits ------- 5b545240c6 [PhpUnitBridge][Console][VarDumper] Add support for `FORCE_COLOR` environment variable
2 parents c085e7a + ed42358 commit ee553bc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: DeprecationErrorHandler.php

+5
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ private static function hasColorSupport(): bool
411411
return false;
412412
}
413413

414+
// Follow https://force-color.org/
415+
if ('' !== (($_SERVER['FORCE_COLOR'] ?? getenv('FORCE_COLOR'))[0] ?? '')) {
416+
return true;
417+
}
418+
414419
// Detect msysgit/mingw and assume this is a tty because detection
415420
// does not work correctly, see https://github.com/composer/composer/issues/9690
416421
if (!@stream_isatty(\STDOUT) && !\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {

0 commit comments

Comments
 (0)