ReferenceResolver
Methods
- assertResolved() : void
- The gate. Refuses to hand an unresolved tree to execution.
- bind() : T)
- resolve(), assertResolved(), refuse an array_expand() in $method, and refuse a result whose bare type is not $returns when given.
- resolve() : T)
- A new tree whose every reachable UnresolvedReference is replaced by a ResolvedReference carrying its Type and nullability. Never mutates $function.
Methods
assertResolved()
The gate. Refuses to hand an unresolved tree to execution.
public
assertResolved(FunctionTree $function, Schema $schema) : void
Parameters
- $function : FunctionTree
- $schema : Schema
Tags
bind()
resolve(), assertResolved(), refuse an array_expand() in $method, and refuse a result whose bare type is not $returns when given.
public
bind(T $function, Schema $schema, string $method[, null|Type<string|int, mixed> $returns = null ]) : T)
Parameters
- $function : T
- $schema : Schema
- $method : string
- $returns : null|Type<string|int, mixed> = null
Tags
Return values
T)resolve()
A new tree whose every reachable UnresolvedReference is replaced by a ResolvedReference carrying its Type and nullability. Never mutates $function.
public
resolve(T $function, Schema $schema) : T)
Total: a reference the schema does not know is left unresolved, not thrown on.
One pass, not a fixpoint - the only nodes it inserts are the Casts TemporalStringCoercion wraps around operands already resolved, and a Cast adds no reference, so a post-order pass over a finite tree converges in one traversal.
Sound: the only non-leaf returns are withChildren() and withOperands(), both typed static; a root that is itself a reference leaf resolves to its Reference sibling class, never to a foreign node.
Parameters
- $function : T
- $schema : Schema