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
2 changes: 1 addition & 1 deletion src/builders/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl ClassBuilder {
/// * `func` - The function entry to add to the class.
/// * `flags` - Flags relating to the function. See [`MethodFlags`].
pub fn method(mut self, mut func: FunctionEntry, flags: MethodFlags) -> Self {
func.flags = flags.bits();
func.flags |= flags.bits();
self.methods.push(func);
self
}
Expand Down
26 changes: 25 additions & 1 deletion src/builders/function.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
args::{Arg, ArgInfo},
error::{Error, Result},
flags::DataType,
flags::{DataType, MethodFlags},
types::Zval,
zend::{ExecuteData, FunctionEntry, ZendType},
};
Expand Down Expand Up @@ -64,6 +64,30 @@ impl<'a> FunctionBuilder<'a> {
}
}

/// Create a new function builder for an abstract function that can be used
/// on an abstract class or an interface.
///
/// # Parameters
///
/// * `name` - The name of the function.
pub fn new_abstract<T: Into<String>>(name: T) -> Self {
Self {
name: name.into(),
function: FunctionEntry {
fname: ptr::null(),
handler: None,
arg_info: ptr::null(),
num_args: 0,
flags: MethodFlags::Abstract.bits(),
},
args: vec![],
n_req: None,
retval: None,
ret_as_ref: false,
ret_as_null: false,
}
}

/// Creates a constructor builder, used to build the constructor
/// for classes.
///
Expand Down