File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -343,18 +343,12 @@ impl Arg {
343343 }
344344 Type :: Reference ( ref_) => {
345345 // Returning references is invalid, so let's just create our arg
346-
347- // Change any `&mut T` into `&T` and set the `as_ref` attribute on the Arg
348- // to marked it as a "passed by ref" PHP argument.
349- let mut ref_ = ref_. clone ( ) ;
350- let is_mutable_ref = ref_. mutability . is_some ( ) ;
351- ref_. mutability = None ;
352346 Some ( Arg :: new (
353347 name,
354348 ref_. to_token_stream ( ) . to_string ( ) ,
355349 false ,
356350 default,
357- is_mutable_ref ,
351+ ref_ . mutability . is_some ( ) ,
358352 ) )
359353 }
360354 _ => None ,
Original file line number Diff line number Diff line change @@ -45,3 +45,17 @@ pub fn test_bool(input: bool) -> String {
4545var_dump(test_bool(true)); // string(4) "Yes!"
4646var_dump(test_bool(false)); // string(3) "No!"
4747```
48+
49+ ## Rust example, taking by reference
50+
51+ ``` rust,no_run
52+ # #![cfg_attr(windows, feature(abi_vectorcall))]
53+ # extern crate ext_php_rs;
54+ # use ext_php_rs::prelude::*;
55+ # use ext_php_rs::types;
56+ #[php_function]
57+ pub fn test_bool(input: &mut types::Zval) {
58+ input.reference_mut().unwrap().set_bool(false);
59+ }
60+ # fn main() {}
61+ ```
You can’t perform that action at this time.
0 commit comments