@@ -236,7 +236,8 @@ fn find_global_class_entry_ptr(name: impl AsRef<str>) -> *mut zend_class_entry {
236236}
237237
238238/// The [StateClass] holds [zend_class_entry] and inner state, created by
239- /// [Module::add_class](crate::modules::Module::add_class).
239+ /// [Module::add_class](crate::modules::Module::add_class) or
240+ /// [ClassEntity::bind_class].
240241///
241242/// When the class registered (module initialized), the [StateClass] will
242243/// be initialized, so you can use the [StateClass] to new stateful
@@ -690,8 +691,25 @@ impl<T: 'static> ClassEntity<T> {
690691 . collect ( )
691692 }
692693
694+ /// Get the bound class.
695+ ///
696+ /// # Examples
697+ ///
698+ /// ```
699+ /// use phper::classes::{ClassEntity, Visibility};
700+ ///
701+ /// pub fn make_foo_class() -> ClassEntity<()> {
702+ /// let mut class = ClassEntity::<()>::new_with_default_state_constructor("Foo");
703+ /// let foo_class = class.bind_class();
704+ /// class.add_static_method("newInstance", Visibility::Public, move |_| {
705+ /// let mut object = foo_class.init_object()?;
706+ /// Ok::<_, phper::Error>(object)
707+ /// });
708+ /// class
709+ /// }
710+ /// ```
693711 #[ inline]
694- pub ( crate ) fn bind_class ( & self ) -> StateClass < T > {
712+ pub fn bind_class ( & self ) -> StateClass < T > {
695713 self . bind_class . clone ( )
696714 }
697715}
@@ -798,8 +816,9 @@ impl InterfaceEntity {
798816 Box :: into_raw ( methods. into_boxed_slice ( ) ) . cast ( )
799817 }
800818
819+ /// Get the bound interface.
801820 #[ inline]
802- pub ( crate ) fn bind_interface ( & self ) -> Interface {
821+ pub fn bind_interface ( & self ) -> Interface {
803822 self . bind_interface . clone ( )
804823 }
805824}
0 commit comments