Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit58cdb04

Browse files
committed
feature#19657 [VarDumper] Add line in trace indexes (nicolas-grekas)
This PR was merged into the 3.2-dev branch.Discussion----------[VarDumper] Add line in trace indexes| Q | A| ------------- | ---| Branch? | master| New feature? | yes| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Allows seeing the line number when the frames are collapsed, e.g.:![capture du 2016-08-18 13-48-27](https://cloud.githubusercontent.com/assets/243674/17772691/872c6bd0-654a-11e6-9886-95fe57baca61.png)Commits-------0b13016 [VarDumper] Add line in trace indexes
2 parents12d0442 +0b13016 commit58cdb04

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)

[8]ページ先頭

©2009-2025 Movatter.jp