[VarDumper] Add line in trace indexes
This commit is contained in:
parent
885c388917
commit
0b13016d2e
@ -158,13 +158,13 @@ class ExceptionCaster
|
||||
$templateSrc = explode("\n", method_exists($template, 'getSource') ? $template->getSource() : $template->getEnvironment()->getLoader()->getSource($templateName));
|
||||
$templateInfo = $template->getDebugInfo();
|
||||
if (isset($templateInfo[$f['line']])) {
|
||||
$src[$templateName] = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext);
|
||||
$src[$templateName.':'.$templateInfo[$f['line']]] = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext);
|
||||
}
|
||||
} catch (\Twig_Error_Loader $e) {
|
||||
}
|
||||
}
|
||||
if (!$src) {
|
||||
$src[$f['file']] = self::extractSource(explode("\n", file_get_contents($f['file'])), $f['line'], self::$srcContext);
|
||||
$src[$f['file'].':'.$f['line']] = self::extractSource(explode("\n", file_get_contents($f['file'])), $f['line'], self::$srcContext);
|
||||
}
|
||||
} else {
|
||||
$src[$f['file']] = $f['line'];
|
||||
|
@ -40,12 +40,12 @@ Exception {
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 23
|
||||
-trace: {
|
||||
%d. %sExceptionCasterTest.php: {
|
||||
%d. %sExceptionCasterTest.php:23: {
|
||||
22: {
|
||||
23: return new \Exception('foo');
|
||||
24: }
|
||||
}
|
||||
%d. %sExceptionCasterTest.php: {
|
||||
%d. %sExceptionCasterTest.php:%d: {
|
||||
%d: {
|
||||
%d: $e = $this->getTestException(1);
|
||||
%d:
|
||||
@ -71,12 +71,12 @@ Exception {
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 23
|
||||
-trace: {
|
||||
%d. %sExceptionCasterTest.php: {
|
||||
%d. %sExceptionCasterTest.php:23: {
|
||||
22: {
|
||||
23: return new \Exception('foo');
|
||||
24: }
|
||||
}
|
||||
%d. %sExceptionCasterTest.php: {
|
||||
%d. %sExceptionCasterTest.php:%d: {
|
||||
%d: {
|
||||
%d: $e = $this->getTestException(1);
|
||||
%d: ExceptionCaster::$traceArgs = false;
|
||||
|
@ -156,7 +156,7 @@ Generator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
executing: {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz(): {
|
||||
%sGeneratorDemo.php: {
|
||||
%sGeneratorDemo.php:14: {
|
||||
13: {
|
||||
14: yield from bar();
|
||||
15: }
|
||||
@ -177,17 +177,17 @@ array:2 [
|
||||
0 => ReflectionGenerator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
trace: {
|
||||
3. %sGeneratorDemo.php: {
|
||||
3. %sGeneratorDemo.php:9: {
|
||||
8: {
|
||||
9: yield 1;
|
||||
10: }
|
||||
}
|
||||
2. %sGeneratorDemo.php: {
|
||||
2. %sGeneratorDemo.php:20: {
|
||||
19: {
|
||||
20: yield from GeneratorDemo::foo();
|
||||
21: }
|
||||
}
|
||||
1. %sGeneratorDemo.php: {
|
||||
1. %sGeneratorDemo.php:14: {
|
||||
13: {
|
||||
14: yield from bar();
|
||||
15: }
|
||||
@ -197,7 +197,7 @@ array:2 [
|
||||
1 => Generator {
|
||||
executing: {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
|
||||
%sGeneratorDemo.php: {
|
||||
%sGeneratorDemo.php:10: {
|
||||
9: yield 1;
|
||||
10: }
|
||||
11:
|
||||
|
@ -264,7 +264,7 @@ EOTXT
|
||||
|
||||
if (method_exists($twig, 'getSource')) {
|
||||
$twig = <<<EOTXT
|
||||
foo.twig: {
|
||||
foo.twig:%d: {
|
||||
1: foo bar
|
||||
2: twig source
|
||||
3:
|
||||
@ -289,22 +289,22 @@ stream resource {@{$ref}
|
||||
#message: "Unexpected Exception thrown from a caster: Foobar"
|
||||
-trace: {
|
||||
%d. {$twig}
|
||||
%d. %sTemplate.php: {
|
||||
%d. %sTemplate.php:%d: {
|
||||
%d: try {
|
||||
%d: \$this->doDisplay(\$context, \$blocks);
|
||||
%d: } catch (Twig_Error \$e) {
|
||||
}
|
||||
%d. %sTemplate.php: {
|
||||
%d. %sTemplate.php:%d: {
|
||||
%d: {
|
||||
%d: \$this->displayWithErrorHandling(\$this->env->mergeGlobals(\$context), array_merge(\$this->blocks, \$blocks));
|
||||
%d: }
|
||||
}
|
||||
%d. %sTemplate.php: {
|
||||
%d. %sTemplate.php:%d: {
|
||||
%d: try {
|
||||
%d: \$this->display(\$context);
|
||||
%d: } catch (Exception \$e) {
|
||||
}
|
||||
%d. %sCliDumperTest.php: {
|
||||
%d. %sCliDumperTest.php:{$line}: {
|
||||
%d: }
|
||||
{$line}: };'),
|
||||
%d: ));
|
||||
|
Reference in New Issue
Block a user