Skip to content

Commit df58ba3

Browse files
nlemoinenicolas-grekas
authored andcommitted
[ErrorHandler] Improve fileLinkFormat handling
- Avoid repeating file link format guessing (logic is already in FileLinkFormatter class) - Always set a fileLinkFormat to a FileLinkFormatter object to handle path mappings properly
1 parent 4e6c3f4 commit df58ba3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Dumper/ContextProvider/SourceContextProvider.php

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

1212
namespace Symfony\Component\VarDumper\Dumper\ContextProvider;
1313

14-
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
14+
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
15+
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter as LegacyFileLinkFormatter;
1516
use Symfony\Component\VarDumper\Cloner\VarCloner;
1617
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
1718
use Symfony\Component\VarDumper\VarDumper;
@@ -30,7 +31,7 @@ final class SourceContextProvider implements ContextProviderInterface
3031
private ?string $projectDir;
3132
private ?FileLinkFormatter $fileLinkFormatter;
3233

33-
public function __construct(string $charset = null, string $projectDir = null, FileLinkFormatter $fileLinkFormatter = null, int $limit = 9)
34+
public function __construct(string $charset = null, string $projectDir = null, FileLinkFormatter|LegacyFileLinkFormatter $fileLinkFormatter = null, int $limit = 9)
3435
{
3536
$this->charset = $charset;
3637
$this->projectDir = $projectDir;

VarDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Symfony\Component\VarDumper;
1313

14+
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
1415
use Symfony\Component\HttpFoundation\Request;
1516
use Symfony\Component\HttpFoundation\RequestStack;
16-
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
1717
use Symfony\Component\VarDumper\Caster\ReflectionCaster;
1818
use Symfony\Component\VarDumper\Cloner\VarCloner;
1919
use Symfony\Component\VarDumper\Dumper\CliDumper;

0 commit comments

Comments
 (0)