ReferenceResolver
Read onlyYes
FinalYes
Methods
- assertResolved() : void
- The gate. Refuses to hand an unresolved tree to execution.
- 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
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 - this resolver inserts nothing, so a post-order pass over a finite tree converges in one traversal by construction. The day a coercion pass inserts Cast nodes into this tree, the pass count must be re-decided.
Sound: the only non-leaf return is $function->withChildren(), 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