44
55namespace Spiral \Prototype \ClassNode ;
66
7+ use phpDocumentor \Reflection \Types \ClassString ;
78use Spiral \Prototype \Utils ;
89
910final class Type
1011{
12+ /** @var non-empty-string|null */
1113 public ?string $ alias = null ;
1214
15+ /**
16+ * @param non-empty-string $shortName
17+ * @param non-empty-string|null $fullName
18+ */
1319 private function __construct (
1420 public readonly string $ shortName ,
1521 public readonly ?string $ fullName = null ,
1622 ) {}
1723
24+ /**
25+ * @param non-empty-string $name
26+ */
1827 public static function create (string $ name ): Type
1928 {
2029 $ fullName = null ;
@@ -26,11 +35,17 @@ public static function create(string $name): Type
2635 return new self ($ name , $ fullName );
2736 }
2837
38+ /**
39+ * @return non-empty-string
40+ */
2941 public function getAliasOrShortName (): string
3042 {
3143 return $ this ->alias ?: $ this ->shortName ;
3244 }
3345
46+ /**
47+ * @return non-empty-string
48+ */
3449 public function getSlashedShortName (bool $ builtIn ): string
3550 {
3651 $ type = $ this ->shortName ;
@@ -41,6 +56,9 @@ public function getSlashedShortName(bool $builtIn): string
4156 return $ type ;
4257 }
4358
59+ /**
60+ * @return non-empty-string
61+ */
4462 public function name (): string
4563 {
4664 return $ this ->fullName ?? $ this ->shortName ;
0 commit comments