Skip to content

Commit abbfefa

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Validator] Missing translations for Estonian (et) [HttpFoundation] Prevent duplicated headers when using Early Hints [VarDumper] Fix configuring CliDumper with SYMFONY_IDE env var [Cache] improve BC with 5.4 pools [PhpUnitBridge][VarDumper] fix color detection [CI] Make sure we preserve file->header when we run sync-translations.php [Cache] Fix BC layer with pre-6.1 cache items Review validators.sl.xlf [Mailer][Postmark][Webhook] Don't require tag and metadata [Scheduler] Fix messenger receiver with no alias
2 parents c0cd6eb + b1040d4 commit abbfefa

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

Dumper/CliDumper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\VarDumper\Dumper;
1313

14+
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
1415
use Symfony\Component\VarDumper\Cloner\Cursor;
1516
use Symfony\Component\VarDumper\Cloner\Stub;
1617

@@ -82,7 +83,7 @@ public function __construct($output = null, ?string $charset = null, int $flags
8283
]);
8384
}
8485

85-
$this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l';
86+
$this->displayOptions['fileLinkFormat'] = class_exists(FileLinkFormatter::class) ? new FileLinkFormatter() : (\ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l');
8687
}
8788

8889
/**
@@ -593,7 +594,7 @@ private function hasColorSupport(mixed $stream): bool
593594
// Detect msysgit/mingw and assume this is a tty because detection
594595
// does not work correctly, see https://github.com/composer/composer/issues/9690
595596
if (!@stream_isatty($stream) && !\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {
596-
return true;
597+
return false;
597598
}
598599

599600
if ('\\' === \DIRECTORY_SEPARATOR && @sapi_windows_vt100_support($stream)) {

Tests/Dumper/CliDumperTest.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\VarDumper\Tests\Dumper;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\VarDumper\Caster\ClassStub;
1516
use Symfony\Component\VarDumper\Caster\CutStub;
1617
use Symfony\Component\VarDumper\Cloner\Data;
1718
use Symfony\Component\VarDumper\Cloner\Stub;
@@ -479,7 +480,7 @@ public function testCollapse()
479480
],
480481
[
481482
'bar' => 123,
482-
]
483+
],
483484
]);
484485

485486
$dumper = new CliDumper();
@@ -499,4 +500,30 @@ public function testCollapse()
499500
$dump
500501
);
501502
}
503+
504+
public function testFileLinkFormat()
505+
{
506+
$data = new Data([
507+
[
508+
new ClassStub(self::class),
509+
],
510+
]);
511+
512+
$ide = $_ENV['SYMFONY_IDE'] ?? null;
513+
$_ENV['SYMFONY_IDE'] = 'vscode';
514+
515+
try {
516+
$dumper = new CliDumper();
517+
$dumper->setColors(true);
518+
$dump = $dumper->dump($data, true);
519+
520+
$this->assertStringMatchesFormat('%svscode:%sCliDumperTest%s', $dump);
521+
} finally {
522+
if (null === $ide) {
523+
unset($_ENV['SYMFONY_IDE']);
524+
} else {
525+
$_ENV['SYMFONY_IDE'] = $ide;
526+
}
527+
}
528+
}
502529
}

0 commit comments

Comments
 (0)