Skip to content

Commit 23dfeba

Browse files
[VarDumper] Fix merge
1 parent cd58420 commit 23dfeba

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Caster/ReflectionCaster.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra
157157
));
158158

159159
if (isset($a[$prefix.'returnType'])) {
160-
$v = (string) $a[$prefix.'returnType'];
161-
$a[$prefix.'returnType'] = new ClassStub($v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
160+
$v = method_exists('ReflectionType', 'getName') ? $a[$prefix.'returnType']->getName() : $a[$prefix.'returnType']->__toString();
161+
$a[$prefix.'returnType'] = new ClassStub(($a[$prefix.'returnType']->allowsNull() ? '?' : '').$v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
162162
}
163163
if (isset($a[$prefix.'class'])) {
164164
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
@@ -240,8 +240,7 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st
240240
if (isset($a[$prefix.'typeHint'])) {
241241
$v = $a[$prefix.'typeHint'];
242242
$a[$prefix.'typeHint'] = new ClassStub($v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
243-
}
244-
if (!isset($a[$prefix.'typeHint'])) {
243+
} else {
245244
unset($a[$prefix.'allowsNull']);
246245
}
247246

0 commit comments

Comments
 (0)