Skip to content

TypeResolver

Builds TypeRef trees from what the source says, resolving names the way PHP would.

A docblock writes Route, not Quiote\Routing\Route; only the declaring file’s use statements say which Route that is. Reflection cannot supply them, which is why the scanner collects them and they arrive here as the ScannedType context.

final class TypeResolver

SourceDocblock/TypeResolver.php

public function __construct(): mixed

Returns mixed

MethodDescription
fromDocString(?string $type, ScannedType $context): ?TypeRefConverts a type as written in a docblock, which is usually the narrower of the two: list<Route> where the signature could only say array.
fromReflection(?ReflectionType $type, ScannedType $context): TypeRefConverts a native parameter, property or return type.

public function fromDocString(?string $type, ScannedType $context): ?TypeRef

Converts a type as written in a docblock, which is usually the narrower of the two: list<Route> where the signature could only say array.

ParameterTypeDescription
$type?``string
$contextScannedType

Returns ?TypeRef

public function fromReflection(?ReflectionType $type, ScannedType $context): TypeRef

Converts a native parameter, property or return type.

ParameterTypeDescription
$type?``ReflectionType
$contextScannedType

Returns TypeRef