[VarDumper] Fix ReflectionNamedType->getName() detection
This commit is contained in:
parent
3086fd38e5
commit
dda18df6de
@ -115,7 +115,8 @@ class ReflectionCaster
|
|||||||
));
|
));
|
||||||
|
|
||||||
if (isset($a[$prefix.'returnType'])) {
|
if (isset($a[$prefix.'returnType'])) {
|
||||||
$a[$prefix.'returnType'] = method_exists('ReflectionType', 'getName') ? $a[$prefix.'returnType']->getName() : $a[$prefix.'returnType']->__toString();
|
$v = $a[$prefix.'returnType'];
|
||||||
|
$a[$prefix.'returnType'] = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
|
||||||
}
|
}
|
||||||
if (isset($a[$prefix.'this'])) {
|
if (isset($a[$prefix.'this'])) {
|
||||||
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
|
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
|
||||||
@ -168,9 +169,9 @@ class ReflectionCaster
|
|||||||
));
|
));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (method_exists($c, 'hasType')) {
|
if (method_exists($c, 'getType')) {
|
||||||
if ($c->hasType()) {
|
if ($v = $c->getType()) {
|
||||||
$a[$prefix.'typeHint'] = method_exists('ReflectionType', 'getName') ? $c->getType()->getName() : $c->getType()->__toString();
|
$a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$v = explode(' ', $c->__toString(), 6);
|
$v = explode(' ', $c->__toString(), 6);
|
||||||
@ -196,7 +197,7 @@ class ReflectionCaster
|
|||||||
unset($a[$prefix.'allowsNull']);
|
unset($a[$prefix.'allowsNull']);
|
||||||
}
|
}
|
||||||
} catch (\ReflectionException $e) {
|
} catch (\ReflectionException $e) {
|
||||||
if (isset($a[$prefix.'typeHint']) && $c->allowsNull() && !method_exists('ReflectionType', 'getName')) {
|
if (isset($a[$prefix.'typeHint']) && $c->allowsNull() && !class_exists('ReflectionNamedType', false)) {
|
||||||
$a[$prefix.'default'] = null;
|
$a[$prefix.'default'] = null;
|
||||||
unset($a[$prefix.'allowsNull']);
|
unset($a[$prefix.'allowsNull']);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user