Skip to content

Commit

Permalink
bug #20931 [VarDumper] Fix dumping by-ref variadics (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] Fix dumping by-ref variadics

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

The correct php syntax is `&...$foo`, not ~~`...&$foo`~~

Commits
-------

28ec361 [VarDumper] Fix dumping by-ref variadics
  • Loading branch information
nicolas-grekas committed Dec 15, 2016
2 parents cf9f541 + 28ec361 commit 4299dae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php
Expand Up @@ -125,12 +125,12 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra

foreach ($c->getParameters() as $v) {
$k = '$'.$v->name;
if ($v->isPassedByReference()) {
$k = '&'.$k;
}
if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
$k = '...'.$k;
}
if ($v->isPassedByReference()) {
$k = '&'.$k;
}
$a[$prefix.'parameters'][$k] = $v;
}

Expand Down

0 comments on commit 4299dae

Please sign in to comment.