Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 018e33a

Browse files
committed
bug #39629 [VarDumper] fixed displaying "mixed" as "?mixed" (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [VarDumper] fixed displaying "mixed" as "?mixed" | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 87dc694 [VarDumper] fixed displaying "mixed" as "?mixed"
2 parents 457c8b1 + 87dc694 commit 018e33a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra
183183
if (isset($a[$prefix.'returnType'])) {
184184
$v = $a[$prefix.'returnType'];
185185
$v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
186-
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
186+
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() && 'mixed' !== $v ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
187187
}
188188
if (isset($a[$prefix.'class'])) {
189189
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
@@ -323,7 +323,7 @@ public static function getSignature(array $a)
323323
if (!$type instanceof \ReflectionNamedType) {
324324
$signature .= $type.' ';
325325
} else {
326-
if (!$param->isOptional() && $param->allowsNull()) {
326+
if (!$param->isOptional() && $param->allowsNull() && 'mixed' !== $type->getName()) {
327327
$signature .= '?';
328328
}
329329
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';

0 commit comments

Comments
 (0)