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.
Synopsis
Section titled “Synopsis”final class TypeResolver
| Source | Docblock/TypeResolver.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(): mixed
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
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. |
fromReflection(?ReflectionType $type, ScannedType $context): TypeRef | Converts a native parameter, property or return type. |
fromDocString()
Section titled “fromDocString()”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.
| Parameter | Type | Description |
|---|---|---|
$type | ?``string | |
$context | ScannedType |
Returns ?TypeRef
fromReflection()
Section titled “fromReflection()”public function fromReflection(?ReflectionType $type, ScannedType $context): TypeRef
Converts a native parameter, property or return type.
| Parameter | Type | Description |
|---|---|---|
$type | ?``ReflectionType | |
$context | ScannedType |
Returns TypeRef