diff --git a/phper/src/classes.rs b/phper/src/classes.rs index 0d4169aa..ff8df16d 100644 --- a/phper/src/classes.rs +++ b/phper/src/classes.rs @@ -235,7 +235,7 @@ fn find_global_class_entry_ptr(name: impl AsRef) -> *mut zend_class_entry { /// The [StateClass] holds [zend_class_entry] and inner state, created by /// [Module::add_class](crate::modules::Module::add_class) or -/// [ClassEntity::bind_class]. +/// [ClassEntity::bound_class]. /// /// When the class registered (module initialized), the [StateClass] will /// be initialized, so you can use the [StateClass] to new stateful @@ -436,7 +436,7 @@ pub struct ClassEntity { parent: Option>, interfaces: Vec, constants: Vec, - bind_class: StateClass, + bound_class: StateClass, state_cloner: Option>, _p: PhantomData<(*mut (), T)>, } @@ -474,7 +474,7 @@ impl ClassEntity { parent: None, interfaces: Vec::new(), constants: Vec::new(), - bind_class: StateClass::null(), + bound_class: StateClass::null(), state_cloner: None, _p: PhantomData, } @@ -673,7 +673,7 @@ impl ClassEntity { parent.cast(), ); - self.bind_class.bind(class_ce); + self.bound_class.bind(class_ce); for interface in &self.interfaces { let interface_ce = interface.as_class_entry().as_ptr(); @@ -761,7 +761,7 @@ impl ClassEntity { /// /// pub fn make_foo_class() -> ClassEntity<()> { /// let mut class = ClassEntity::<()>::new_with_default_state_constructor("Foo"); - /// let foo_class = class.bind_class(); + /// let foo_class = class.bound_class(); /// class.add_static_method("newInstance", Visibility::Public, move |_| { /// let mut object = foo_class.init_object()?; /// Ok::<_, phper::Error>(object) @@ -770,8 +770,8 @@ impl ClassEntity { /// } /// ``` #[inline] - pub fn bind_class(&self) -> StateClass { - self.bind_class.clone() + pub fn bound_class(&self) -> StateClass { + self.bound_class.clone() } } @@ -794,7 +794,7 @@ pub struct InterfaceEntity { method_entities: Vec, constants: Vec, extends: Vec &'static ClassEntry>>, - bind_interface: Interface, + bound_interface: Interface, } impl InterfaceEntity { @@ -805,7 +805,7 @@ impl InterfaceEntity { method_entities: Vec::new(), constants: Vec::new(), extends: Vec::new(), - bind_interface: Interface::null(), + bound_interface: Interface::null(), } } @@ -858,7 +858,7 @@ impl InterfaceEntity { null_mut(), ); - self.bind_interface.bind(class_ce); + self.bound_interface.bind(class_ce); for interface in &self.extends { let interface_ce = interface().as_ptr(); @@ -889,8 +889,8 @@ impl InterfaceEntity { /// Get the bound interface. #[inline] - pub fn bind_interface(&self) -> Interface { - self.bind_interface.clone() + pub fn bound_interface(&self) -> Interface { + self.bound_interface.clone() } } diff --git a/phper/src/modules.rs b/phper/src/modules.rs index c0d4a0e0..f1fba874 100644 --- a/phper/src/modules.rs +++ b/phper/src/modules.rs @@ -206,17 +206,17 @@ impl Module { /// Register class to module. pub fn add_class(&mut self, class: ClassEntity) -> StateClass { - let bind_class = class.bind_class(); + let bound_class = class.bound_class(); self.class_entities .push(unsafe { transmute::, ClassEntity<()>>(class) }); - bind_class + bound_class } /// Register interface to module. pub fn add_interface(&mut self, interface: InterfaceEntity) -> Interface { - let bind_interface = interface.bind_interface(); + let bound_interface = interface.bound_interface(); self.interface_entities.push(interface); - bind_interface + bound_interface } /// Register constant to module. diff --git a/tests/integration/src/classes.rs b/tests/integration/src/classes.rs index b6fbee51..875c61e2 100644 --- a/tests/integration/src/classes.rs +++ b/tests/integration/src/classes.rs @@ -31,7 +31,7 @@ pub fn integrate(module: &mut Module) { fn integrate_a(module: &mut Module) { let mut class = ClassEntity::new("IntegrationTest\\A"); - let integrate_a_class = class.bind_class(); + let integrate_a_class = class.bound_class(); class.add_property("name", Visibility::Private, "default"); class.add_property("number", Visibility::Private, 100); diff --git a/tests/integration/tests/php/classes.php b/tests/integration/tests/php/classes.php index cdd8dbb1..5144a372 100644 --- a/tests/integration/tests/php/classes.php +++ b/tests/integration/tests/php/classes.php @@ -29,7 +29,7 @@ $property_name = $reflection_class->getProperty("name"); assert_true($property_name->isPrivate()); -// Test bind_class +// Test bound_class $a_instance = IntegrationTest\A::newInstance(); assert_true($a_instance instanceof IntegrationTest\A); assert_eq($a_instance->speak(), "name: default, number: 100"); @@ -104,4 +104,4 @@ class Foo2 extends IntegrationTest\Foo {} // Test module class extends module class $bar = new \IntegrationTest\BarExtendsFoo; //Bar should extend Foo $reflection = new ReflectionClass($bar); -assert_true($reflection->isSubclassOf(IntegrationTest\Foo::class)); \ No newline at end of file +assert_true($reflection->isSubclassOf(IntegrationTest\Foo::class));