Skip to content

Commit d11a4f7

Browse files
committed
Support of literal class string
1 parent c030d72 commit d11a4f7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ShowTypePrettier.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private static function atomic(Atomic $atomic, Codebase $codebase, int $level):
3434
$atomic instanceof Atomic\TClosure => self::callable($atomic, $codebase, $level),
3535
$atomic instanceof Atomic\TCallable => self::callable($atomic, $codebase, $level),
3636
$atomic instanceof Atomic\TClassString => self::classString($atomic, $codebase, $level),
37+
$atomic instanceof Atomic\TLiteralClassString => self::literalClassString($atomic),
3738
$atomic instanceof Atomic\TNamedObject => self::namedObject($atomic, $codebase, $level),
3839
$atomic instanceof Atomic\TKeyedArray => self::keyedArray($atomic, $codebase, $level),
3940
$atomic instanceof Atomic\TTemplateParam => self::templateParam($atomic, $codebase, $level),
@@ -52,10 +53,15 @@ private static function iterable(Atomic\TIterable $atomic, Codebase $codebase, i
5253
private static function classString(Atomic\TClassString $atomic, Codebase $codebase, int $level): string
5354
{
5455
return null !== $atomic->as_type
55-
? 'class-string<' . self::namedObject($atomic->as_type, $codebase, $level) . '>'
56+
? self::namedObject($atomic->as_type, $codebase, $level) . '::class'
5657
: 'class-string';
5758
}
5859

60+
private static function literalClassString(Atomic\TLiteralClassString $atomic): string
61+
{
62+
return self::shortClassName($atomic->value) . '::class';
63+
}
64+
5965
private static function templateParam(Atomic\TTemplateParam $atomic, Codebase $codebase, int $level): string
6066
{
6167
$shortClassName = self::shortClassName($atomic->defining_class);

0 commit comments

Comments
 (0)