Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/macros/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ impl<'a> Function<'a> {
}

fn build_returns(&self) -> Option<TokenStream> {
self.output.as_ref().map(|output| {
self.output.cloned().map(|mut output| {
output.drop_lifetimes();
quote! {
.returns(
<#output as ::ext_php_rs::convert::IntoZval>::TYPE,
Expand Down
2 changes: 2 additions & 0 deletions tests/src/integration/class/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
assert($class->getString() === 'dolor et');
$class->selfRef("foo");
assert($class->getString() === 'Changed to foo');
$class->selfMultiRef("bar");
assert($class->getString() === 'Changed to bar');

assert($class->getNumber() === 2022);
$class->setNumber(2023);
Expand Down
8 changes: 8 additions & 0 deletions tests/src/integration/class/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ impl TestClass {
self_.string = format!("Changed to {val}");
self_
}

pub fn self_multi_ref<'a>(
self_: &'a mut ZendClassObject<TestClass>,
val: &str,
) -> &'a mut ZendClassObject<TestClass> {
self_.string = format!("Changed to {val}");
self_
}
}

#[php_function]
Expand Down
Loading