Skip to main content

is_php_prop_scalar

Function is_php_prop_scalar 

Source
pub fn is_php_prop_scalar(ty: &TypeRef, enum_names: &AHashSet<String>) -> bool
Expand description

Returns true if the type is “scalar-compatible” — i.e. ext-php-rs can handle it as a Check if a type is scalar-compatible for PHP properties, considering enum names. #[php(prop)] without needing a manual getter. Scalar-compatible means the mapped Rust type implements IntoZval + FromZval automatically: primitives, String, bool, Duration (→ u64), Path (→ String), Option, Vec (the Vec<T: IntoZval> blanket impl). Anything containing a Named struct, Map, nested Vec, Json, or Bytes requires a getter. Enums are mapped as String in the PHP binding, so they count as scalar.

This function is public so that alef-e2e can determine which fields require ->getCamelCase() getter-method syntax vs. ->camelCase property syntax.