8000 minor #20120 [VarDumper] Fix merge (nicolas-grekas) · symfony/symfony@9362b8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 9362b8c

Browse files
committed
minor #20120 [VarDumper] Fix merge (nicolas-grekas)
This PR was merged into the 3.2-dev branch. Discussion ---------- [VarDumper] Fix merge | Q | A | ------------- | --- | Branch? | master" | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- f5703e5 [VarDumper] Fix merge
2 parents 362a8ac + f5703e5 commit 9362b8c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Symfony/Component/VarDumper/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)
0