Skip to content

Commit 9eaf17b

Browse files
serious-angelnicolas-grekas
authored andcommitted
[PhpUnitBridge][Console][VarDumper] Add support for FORCE_COLOR environment variable
1 parent bfcd455 commit 9eaf17b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.2
5+
---
6+
7+
* Add support for `FORCE_COLOR` environment variable
8+
49
7.1
510
---
611

Dumper/CliDumper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,11 @@ private function hasColorSupport(mixed $stream): bool
591591
return false;
592592
}
593593

594+
// Follow https://force-color.org/
595+
if ('' !== (($_SERVER['FORCE_COLOR'] ?? getenv('FORCE_COLOR'))[0] ?? '')) {
596+
return true;
597+
}
598+
594599
// Detect msysgit/mingw and assume this is a tty because detection
595600
// does not work correctly, see https://github.com/composer/composer/issues/9690
596601
if (!@stream_isatty($stream) && !\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {

0 commit comments

Comments
 (0)