Skip to content

Commit 18ede97

Browse files
committed
Add ability to set function name on php_function macro
This is much the same as `php_class(name="ABC")`
1 parent 199962c commit 18ede97

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/macros/src/function.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub struct AttrArgs {
1717
optional: Option<String>,
1818
ignore_module: bool,
1919
defaults: HashMap<String, Lit>,
20+
name: Option<String>,
2021
}
2122

2223
#[derive(Debug, Clone)]
@@ -93,7 +94,7 @@ pub fn parser(args: AttributeArgs, input: ItemFn) -> Result<(TokenStream, Functi
9394
}
9495

9596
let function = Function {
96-
name: ident.to_string(),
97+
name: attr_args.name.unwrap_or_else(|| ident.to_string()),
9798
docs: get_docs(&input.attrs),
9899
ident: internal_ident.to_string(),
99100
args,

0 commit comments

Comments
 (0)