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