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
-------
87dc694094
[VarDumper] fixed displaying "mixed" as "?mixed"
This commit is contained in:
commit
018e33ab2d
@ -183,7 +183,7 @@ class ReflectionCaster
|
|||||||
if (isset($a[$prefix.'returnType'])) {
|
if (isset($a[$prefix.'returnType'])) {
|
||||||
$v = $a[$prefix.'returnType'];
|
$v = $a[$prefix.'returnType'];
|
||||||
$v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
|
$v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
|
||||||
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
|
$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 : '', '']);
|
||||||
}
|
}
|
||||||
if (isset($a[$prefix.'class'])) {
|
if (isset($a[$prefix.'class'])) {
|
||||||
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
|
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
|
||||||
@ -323,7 +323,7 @@ class ReflectionCaster
|
|||||||
if (!$type instanceof \ReflectionNamedType) {
|
if (!$type instanceof \ReflectionNamedType) {
|
||||||
$signature .= $type.' ';
|
$signature .= $type.' ';
|
||||||
} else {
|
} else {
|
||||||
if (!$param->isOptional() && $param->allowsNull()) {
|
if (!$param->isOptional() && $param->allowsNull() && 'mixed' !== $type->getName()) {
|
||||||
$signature .= '?';
|
$signature .= '?';
|
||||||
}
|
}
|
||||||
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';
|
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';
|
||||||
|
Reference in New Issue
Block a user