Skip to content

docs(zval): add FromZVal / FromZValMut guidance in _04_zval#235

Merged
jmjoy merged 2 commits intomasterfrom
copilot/update-fromzval-docs
Mar 5, 2026
Merged

docs(zval): add FromZVal / FromZValMut guidance in _04_zval#235
jmjoy merged 2 commits intomasterfrom
copilot/update-fromzval-docs

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

This updates the ZVal documentation to explicitly cover trait-based generic conversion from ZVal. The guide now documents when to use FromZVal/FromZValMut alongside expect_* helpers.

  • What changed

    • Added a new subsection in phper-doc/doc/_04_zval/index.md:
      • Generic conversion via FromZVal / FromZValMut
    • Documented trait roles clearly:
      • FromZVal: conversion from &ZVal
      • FromZValMut: conversion from &mut ZVal
    • Documented the corresponding generic APIs:
      • ZVal::expect_type
      • ZVal::expect_mut_type
  • Example added

    • Included a focused Rust snippet showing generic immutable/mutable conversion helpers and usage:
use phper::values::{FromZVal, FromZValMut, ZVal};

fn expect_immutable<'a, T: FromZVal<'a>>(val: &'a ZVal) -> phper::Result<T> {
    val.expect_type()
}

fn expect_mutable<'a, T: FromZValMut<'a>>(val: &'a mut ZVal) -> phper::Result<T> {
    val.expect_mut_type()
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: jmjoy <8677974+jmjoy@users.noreply.github.com>
Copilot AI changed the title [WIP] Update documentation for FromZVal and FromZValMut docs(zval): add FromZVal / FromZValMut guidance in _04_zval Mar 5, 2026
Copilot finished work on behalf of jmjoy March 5, 2026 06:28
@jmjoy jmjoy marked this pull request as ready for review March 5, 2026 06:45
@jmjoy jmjoy merged commit 3dd9d66 into master Mar 5, 2026
20 checks passed
@jmjoy jmjoy deleted the copilot/update-fromzval-docs branch March 5, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants