Supported Versions: PHP 8
Gets the type name of a variable in a way that is suitable for debugging
<?php get_debug_type(mixed $value): string
<?php $allowedTypes = is_array($type) ? $type : [$type];
return $this->each(function ($item, $index) use ($allowedTypes) {
$itemType = get_debug_type($item);
foreach ($allowedTypes as $allowedType) {
if ($itemType === $allowedType || $item instanceof $allowedType) {
<?php if ($a) {
static $publicProperties = [];
$debugClass = $debugClass ?? get_debug_type($obj);
$i = 0;
$prefixedKeys = [];
<?php if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) {
$b = (array) $a[$xPrefix.'previous'];
$class = get_debug_type($a[$xPrefix.'previous']);
self::traceUnshift($b[$xPrefix.'trace'], $class, $b[$prefix.'file'], $b[$prefix.'line']);
$a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -\count($a[$trace]->value));
}
<?php } elseif (\is_bool($v)) {
$signature .= $v ? 'true' : 'false';
} elseif (\is_object($v)) {
$signature .= 'new '.substr(strrchr('\\'.get_debug_type($v), '\\'), 1);
} else {
$signature .= $v;
}
<?php $class = $stub->class;
if (\PHP_VERSION_ID < 80000 ? "\0" === ($class[15] ?? null) : str_contains($class, "@anonymous\0")) {
$stub->class = get_debug_type($obj);
}
if (isset($this->classInfo[$class])) {
[$i, $parents, $hasDebugInfo, $fileInfo] = $this->classInfo[$class];
<?php public function getIterator()
{
if (!\is_array($value = $this->getValue())) {
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
}
yield from $value;