Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f6f6ea

Browse files
[VarDumper] Add line in trace indexes
1 parent 885c388 commit 4f6f6ea

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $is
158158
$templateSrc = explode("\n", method_exists($template, 'getSource') ? $template->getSource() : $template->getEnvironment()->getLoader()->getSource($templateName));
159159
$templateInfo = $template->getDebugInfo();
160160
if (isset($templateInfo[$f['line']])) {
161-
$src[$templateName] = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext);
161+
$src[$templateName.' +'.$templateInfo[$f['line']]] = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext);
162162
}
163163
} catch (\Twig_Error_Loader $e) {
164164
}
165165
}
166166
if (!$src) {
167-
$src[$f['file']] = self::extractSource(explode("\n", file_get_contents($f['file'])), $f['line'], self::$srcContext);
167+
$src[$f['file'].' +'.$f['line']] = self::extractSource(explode("\n", file_get_contents($f['file'])), $f['line'], self::$srcContext);
168168
}
169169
} else {
170170
$src[$f['file']] = $f['line'];

src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public function testDefaultSettings()
4040
#file: "%sExceptionCasterTest.php"
4141
#line: 23
4242
-trace: {
43-
%d. %sExceptionCasterTest.php: {
43+
%d. %sExceptionCasterTest.php +23: {
4444
22: {
4545
23: return new \Exception('foo');
4646
24: }
4747
}
48-
%d. %sExceptionCasterTest.php: {
48+
%d. %sExceptionCasterTest.php +%d: {
4949
%d: {
5050
%d: $e = $this->getTestException(1);
5151
%d:
@@ -71,12 +71,12 @@ public function testNoArgs()
7171
#file: "%sExceptionCasterTest.php"
7272
#line: 23
7373
-trace: {
74-
%d. %sExceptionCasterTest.php: {
74+
%d. %sExceptionCasterTest.php +23: {
7575
22: {
7676
23: return new \Exception('foo');
7777
24: }
7878
}
79-
%d. %sExceptionCasterTest.php: {
79+
%d. %sExceptionCasterTest.php +%d: {
8080
%d: {
8181
%d: $e = $this->getTestException(1);
8282
%d: ExceptionCaster::$traceArgs = false;

src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testGenerator()
156156
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
157157
executing: {
158158
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz(): {
159-
%sGeneratorDemo.php: {
159+
%sGeneratorDemo.php +14: {
160160
13: {
161161
14: yield from bar();
162162
15: }
@@ -177,17 +177,17 @@ public function testGenerator()
177177
0 => ReflectionGenerator {
178178
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
179179
trace: {
180-
3. %sGeneratorDemo.php: {
180+
3. %sGeneratorDemo.php +9: {
181181
8: {
182182
9: yield 1;
183183
10: }
184184
}
185-
2. %sGeneratorDemo.php: {
185+
2. %sGeneratorDemo.php +20: {
186186
19: {
187187
20: yield from GeneratorDemo::foo();
188188
21: }
189189
}
190-
1. %sGeneratorDemo.php: {
190+
1. %sGeneratorDemo.php +14: {
191191
13: {
192192
14: yield from bar();
193193
15: }
@@ -197,7 +197,7 @@ public function testGenerator()
197197
1 => Generator {
198198
executing: {
199199
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo(): {
200-
%sGeneratorDemo.php: {
200+
%sGeneratorDemo.php +10: {
201201
9: yield 1;
202202
10: }
203203
11:

src/Symfony/Component/VarDumper/Tests/CliDumperTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function testThrowingCaster()
264264

265265
if (method_exists($twig, 'getSource')) {
266266
$twig = <<<EOTXT
267-
foo.twig: {
267+
foo.twig +%d: {
268268
1: foo bar
269269
2: twig source
270270
3:
@@ -289,22 +289,22 @@ public function testThrowingCaster()
289289
#message: "Unexpected Exception thrown from a caster: Foobar"
290290
-trace: {
291291
%d. {$twig}
292-
%d. %sTemplate.php: {
292+
%d. %sTemplate.php +%d: {
293293
%d: try {
294294
%d: \$this->doDisplay(\$context, \$blocks);
295295
%d: } catch (Twig_Error \$e) {
296296
}
297-
%d. %sTemplate.php: {
297+
%d. %sTemplate.php +%d: {
298298
%d: {
299299
%d: \$this->displayWithErrorHandling(\$this->env->mergeGlobals(\$context), array_merge(\$this->blocks, \$blocks));
300300
%d: }
301301
}
302-
%d. %sTemplate.php: {
302+
%d. %sTemplate.php +%d: {
303303
%d: try {
304304
%d: \$this->display(\$context);
305305
%d: } catch (Exception \$e) {
306306
}
307-
%d. %sCliDumperTest.php: {
307+
%d. %sCliDumperTest.php +{$line}: {
308308
%d: }
309309
{$line}: };'),
310310
%d: ));

0 commit comments

Comments
 (0)