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 {
343
343
}
344
344
Type :: Reference ( ref_) => {
345
345
// 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 ;
352
346
Some ( Arg :: new (
353
347
name,
354
348
ref_. to_token_stream ( ) . to_string ( ) ,
355
349
false ,
356
350
default,
357
- is_mutable_ref ,
351
+ ref_ . mutability . is_some ( ) ,
358
352
) )
359
353
}
360
354
_ => None ,
Original file line number Diff line number Diff line change @@ -45,3 +45,17 @@ pub fn test_bool(input: bool) -> String {
45
45
var_dump(test_bool(true)); // string(4) "Yes!"
46
46
var_dump(test_bool(false)); // string(3) "No!"
47
47
```
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