8000 [VarDumper] Fix PHP7 type-hints compat · symfony/symfony@f2ca22e · GitHub
[go: up one dir, main page]

Skip to content

Commit f2ca22e

Browse files
[VarDumper] Fix PHP7 type-hints compat
1 parent 1bed177 commit f2ca22e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st
167167
));
168168

169169
try {
170-
if ($c->isArray()) {
170+
if (method_exists($c, 'hasType')) {
171+
if ($c->hasType()) {
172+
$a[$prefix.'typeHint'] = $c->getType()->__toString();
173+
}
174+
} elseif ($c->isArray()) {
171175
$a[$prefix.'typeHint'] = 'array';
172176
} elseif (method_exists($c, 'isCallable') && $c->isCallable()) {
173177
$a[$prefix.'typeHint'] = 'callable';

0 commit comments

Comments
 (0)
0