Skip to content

Commit eda544c

Browse files
committed
Simplify
1 parent e658ce8 commit eda544c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/zend/class.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Builder and objects for creating classes in the PHP world.
22
3-
use crate::{ffi::zend_class_entry, flags::ClassFlags, types::ZendStr, zend::ExecutorGlobals};
3+
use crate::{ffi::{zend_class_entry}, flags::ClassFlags, types::{ZendStr, ZendObject}, zend::ExecutorGlobals, boxed::ZBox};
44
use std::{convert::TryInto, fmt::Debug, ops::DerefMut};
55

66
/// A PHP class entry.
@@ -22,6 +22,16 @@ impl ClassEntry {
2222
}
2323
}
2424

25+
/// Creates a new [`ZendObject`], returned inside an [`ZBox<ZendObject>`]
26+
/// wrapper.
27+
///
28+
/// # Panics
29+
///
30+
/// Panics when allocating memory for the new object fails.
31+
pub fn new(&self) -> ZBox<ZendObject> {
32+
ZendObject::new(self)
33+
}
34+
2535
/// Returns the class flags.
2636
pub fn flags(&self) -> ClassFlags {
2737
ClassFlags::from_bits_truncate(self.ce_flags)

0 commit comments

Comments
 (0)