pub struct PhpGetterMap {
pub getters: HashMap<String, HashSet<String>>,
pub field_types: HashMap<String, HashMap<String, String>>,
pub root_type: Option<String>,
pub all_fields: HashMap<String, HashSet<String>>,
}Expand description
Per-type PHP getter classification + chain-resolution metadata.
Holds enough information to resolve a multi-segment field path through the IR’s nested type graph and pick the correct accessor style at each segment:
getters[type_name]— set of field names ontype_namewhose PHP binding uses a#[php(getter)]method (caller must emit->getCamelCase()).field_types[type_name][field_name]— the IR-resolvedNamedtype thatfield_nametraverses into, used to advance the “current type” cursor for the next path segment. Absent for terminal/scalar fields.root_type— the IR type name backing the result variable at the start of any chain. WhenNone, chain traversal degrades to per-segment lookup using a flattened union across all types (legacy bare-name behaviour), which produces false positives when field names collide across types.
Fields§
§getters: HashMap<String, HashSet<String>>§field_types: HashMap<String, HashMap<String, String>>§root_type: Option<String>§all_fields: HashMap<String, HashSet<String>>All field names per type — used to detect when the recorded root_type
is a misclassification (a workspace-global root_type may not match the
actual return type of a per-fixture call). When owner_type is set but
all_fields[owner_type] doesn’t contain field_name, the renderer
falls back to the bare-name union instead of trusting the (wrong) owner.
Implementations§
Source§impl PhpGetterMap
impl PhpGetterMap
Sourcepub fn needs_getter(&self, owner_type: Option<&str>, field_name: &str) -> bool
pub fn needs_getter(&self, owner_type: Option<&str>, field_name: &str) -> bool
Returns true if (owner_type, field_name) requires getter-method syntax.
When owner_type is None (root type unknown, or chain advanced into an
unmapped type), falls back to the union across all types: any type
declaring field_name as non-scalar marks it as needing a getter. This
is the legacy behaviour and is unsafe when field names collide.
Trait Implementations§
Source§impl Clone for PhpGetterMap
impl Clone for PhpGetterMap
Source§fn clone(&self) -> PhpGetterMap
fn clone(&self) -> PhpGetterMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more