Skip to content

TypeRef

A type, kept as a tree rather than a string so each part can be linked independently.

list<Quiote\Routing\Route>|null has to render with Route pointing at its own page while list and null stay plain, which a flat string cannot express. Every node carries a display form so a renderer that does not care about linking can ignore the structure entirely.

final class TypeRef implements Stringable

ImplementsStringable
SourceIr/TypeRef.php
ConstantValueDescription
KIND_GENERIC'generic'
KIND_INTERSECTION'intersection'
KIND_LITERAL'literal'
KIND_NAMED'named'
KIND_NULLABLE'nullable'
KIND_UNION'union'
PropertyTypeDescription
$argsarrayreadonly.
$displaystringreadonly.
$fqcn?``stringreadonly.
$kindstringreadonly.
MethodDescription
__toString(): string
generic(TypeRef $base, list<TypeRef> $arguments): TypeRef
intersection(list<TypeRef> $members): TypeRef
literal(string $text): TypeRefA keyword, scalar or anything else with no class behind it to link to.
named(string $fqcn): TypeRefA class-like type, which may or may not be one the reference documents.
nullable(TypeRef $inner): TypeRef
referencedClasses(): list<string>Every named type anywhere in the tree, so a renderer can decide what to link without walking the structure itself.
union(list<TypeRef> $members): TypeRef

public function __toString(): string

Returns string

public static function generic(TypeRef $base, list<TypeRef> $arguments): TypeRef

ParameterTypeDescription
$baseTypeRef
$argumentslist``<TypeRef>

Returns TypeRef

public static function intersection(list<TypeRef> $members): TypeRef

ParameterTypeDescription
$memberslist``<TypeRef>

Returns TypeRef

public static function literal(string $text): TypeRef

A keyword, scalar or anything else with no class behind it to link to.

ParameterTypeDescription
$textstring

Returns TypeRef

public static function named(string $fqcn): TypeRef

A class-like type, which may or may not be one the reference documents.

ParameterTypeDescription
$fqcnstring

Returns TypeRef

public static function nullable(TypeRef $inner): TypeRef

ParameterTypeDescription
$innerTypeRef

Returns TypeRef

public function referencedClasses(): list<string>

Every named type anywhere in the tree, so a renderer can decide what to link without walking the structure itself.

Returns list``<``string``>

public static function union(list<TypeRef> $members): TypeRef

ParameterTypeDescription
$memberslist``<TypeRef>

Returns TypeRef