Skip to content

Commit eeecc76

Browse files
committed
Render \phpDocumentor\Reflection\Type types as PHP types correctly
1 parent 3d968e7 commit eeecc76

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/PHPFUI/InstaDoc/Section/CodeCommon.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,11 @@ protected function getClassName(string | object $class, bool $asLink = true) : s
284284
{
285285
$className = $class::class;
286286

287-
if ('ReflectionNamedType' == $className)
287+
if ($class instanceof \phpDocumentor\Reflection\Type)
288+
{
289+
return \htmlspecialchars($class);
290+
}
291+
elseif ('ReflectionNamedType' == $className)
288292
{
289293
return ($class->allowsNull() ? '?' : '') . $this->getClassName($class->getName());
290294
}
@@ -318,9 +322,7 @@ protected function getClassName(string | object $class, bool $asLink = true) : s
318322
return $value . ')';
319323
}
320324

321-
322325
return $this->getClassName($class::class);
323-
324326
}
325327

326328
if ($asLink && $class)

0 commit comments

Comments
 (0)