Named
NamedType
Section titled “NamedType”class NamedType implements Type{ /** * @param class-string|string $name * @param list<Type> $arguments */ public function __construct( public readonly string $name, public readonly array $arguments = [], ) {}}This is very similar to native reflection’s ReflectionNamedType. Just like the native type, it represents
types that refer to class-likes (e.g. classes, interfaces, traits and enums) and built in primitives.
All of these are considered a NamedType:
int,float,bool,string,object,resourcearray,array<string>,array<string, string>iterable,iterable<string, string>\Exception,\Your\Class,\Generator<string, \Your\Class>callable,callable(string): int,\Closure,\Closure(string): int
However, a few types are handled differently from ReflectionNamedType:
self->NamedTypebut refers to the actual class nameparent->NamedTypebut refers to the actual parent class namestatic-> StaticTypemixed-> MixedType->allowsNull()-> NullableTypenever-> NeverTypevoid-> VoidType