8000 minor #30295 [VarDumper] dump Closures' parameters once: in their sig… · enumag/symfony@e7430f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7430f4

Browse files
minor symfony#30295 [VarDumper] dump Closures' parameters once: in their signatures (nicolas-grekas)
This PR was merged into the 4.3-dev branch. Discussion ---------- [VarDumper] dump Closures' parameters once: in their signatures | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | not really | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Now that closures are dumped with their signature, dumping parameters is noisy duplicate info. Commits ------- f3659b6 [VarDumper] dump Closures' parameters once: in their signatures
2 parents 98693be + f3659b6 commit e7430f4

File tree

4 files changed

+2
-30
lines changed

4 files changed

+2
-30
lines changed

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,7 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested,
5252
return [];
5353
}
5454

55-
if (isset($a[$prefix.'parameters'])) {
56-
foreach ($a[$prefix.'parameters']->value as &$v) {
57-
$param = $v;
58-
$v = new EnumStub([]);
59-
foreach (static::castParameter($param, [], $stub, true) as $k => $param) {
60-
if ("\0" === $k[0]) {
61-
$v->value[substr($k, 3)] = $param;
62-
}
63-
}
64-
unset($v->value['position'], $v->value['isVariadic'], $v->value['byReference'], $v);
65-
}
66-
}
55+
unset($a[$prefix.'parameters']);
6756

6857
if ($f = $c->getFileName()) {
6958
$a[$prefix.'file'] = new LinkStub($f, $c->getStartLine());

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ public function testClosureCaster()
7070
$this->assertDumpMatchesFormat(
7171
<<<'EOTXT'
7272
Closure($x) {
73-
%Aparameters: {
74-
$x: {}
75-
}
76-
use: {
73+
%Ause: {
7774
$a: 123
7875
$b: & 123
7976
}

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ public function testGet()
8181
"closure" => Closure(\$a, PDO &\$b = null) {#%d
8282
class: "Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest"
8383
this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {#%d …}
84-
parameters: {
85-
\$a: {}
86-
&\$b: {
87-
typeHint: "PDO"
88-
default: null
89-
}
90-
}
9184
file: "%s%eTests%eFixtures%edumb-var.php"
9285
line: "{$var['line']} to {$var['line']}"
9386
}

src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ public function testGet()
8585
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest
8686
55 characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-class">Symfony\Component\VarDumper\Tests\Dumper</span><span class=sf-dump-ellipsis>\</span>HtmlDumperTest</span>"
8787
<span class=sf-dump-meta>this</span>: <abbr title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest" class=sf-dump-note>HtmlDumperTest</abbr> {<a class=sf-dump-ref>#%d</a> &%s;}
88-
<span class=sf-dump-meta>parameters</span>: {<samp>
89-
<span class=sf-dump-meta>\$a</span>: {}
90-
<span class=sf-dump-meta>&amp;\$b</span>: {<samp>
91-
<span class=sf-dump-meta>typeHint</span>: "<span class=sf-dump-str title="3 characters">PDO</span>"
92-
<span class=sf-dump-meta>default</span>: <span class=sf-dump-const>null</span>
93-
</samp>}
94-
</samp>}
9588
<span class=sf-dump-meta>file</span>: "<span class=sf-dump-str title="{$var['file']}
9689
%d characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class=sf-dump-ellipsis>%e</span>Tests%eFixtures%edumb-var.php</span>"
9790
<span class=sf-dump-meta>line</span>: "<span class=sf-dump-str title="%d characters">{$var['line']} to {$var['line']}</span>"

0 commit comments

Comments
 (0)
0