fn cast_object_to_string()

in src/plugin/plugin_psr3.rs [207:220]


    fn cast_object_to_string(obj: &mut ZObj) -> crate::Result<Option<String>> {
        if call(
            "method_exists",
            [obj.to_ref_owned().into(), "__toString".into()],
        )?
        .as_bool()
            == Some(true)
        {
            let s = obj.call("__toString", [])?;
            Ok(Some(s.expect_z_str()?.to_str()?.to_string()))
        } else {
            Ok(None)
        }
    }