Skip to content

Commit 58fef19

Browse files
authored
feat!: rename bind_* to bound_* (#192)
1 parent 477bb83 commit 58fef19

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

phper/src/classes.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn find_global_class_entry_ptr(name: impl AsRef<str>) -> *mut zend_class_entry {
235235

236236
/// The [StateClass] holds [zend_class_entry] and inner state, created by
237237
/// [Module::add_class](crate::modules::Module::add_class) or
238-
/// [ClassEntity::bind_class].
238+
/// [ClassEntity::bound_class].
239239
///
240240
/// When the class registered (module initialized), the [StateClass] will
241241
/// be initialized, so you can use the [StateClass] to new stateful
@@ -436,7 +436,7 @@ pub struct ClassEntity<T: 'static> {
436436
parent: Option<StateClass<()>>,
437437
interfaces: Vec<Interface>,
438438
constants: Vec<ConstantEntity>,
439-
bind_class: StateClass<T>,
439+
bound_class: StateClass<T>,
440440
state_cloner: Option<Rc<StateCloner>>,
441441
_p: PhantomData<(*mut (), T)>,
442442
}
@@ -474,7 +474,7 @@ impl<T: 'static> ClassEntity<T> {
474474
parent: None,
475475
interfaces: Vec::new(),
476476
constants: Vec::new(),
477-
bind_class: StateClass::null(),
477+
bound_class: StateClass::null(),
478478
state_cloner: None,
479479
_p: PhantomData,
480480
}
@@ -673,7 +673,7 @@ impl<T: 'static> ClassEntity<T> {
673673
parent.cast(),
674674
);
675675

676-
self.bind_class.bind(class_ce);
676+
self.bound_class.bind(class_ce);
677677

678678
for interface in &self.interfaces {
679679
let interface_ce = interface.as_class_entry().as_ptr();
@@ -761,7 +761,7 @@ impl<T: 'static> ClassEntity<T> {
761761
///
762762
/// pub fn make_foo_class() -> ClassEntity<()> {
763763
/// let mut class = ClassEntity::<()>::new_with_default_state_constructor("Foo");
764-
/// let foo_class = class.bind_class();
764+
/// let foo_class = class.bound_class();
765765
/// class.add_static_method("newInstance", Visibility::Public, move |_| {
766766
/// let mut object = foo_class.init_object()?;
767767
/// Ok::<_, phper::Error>(object)
@@ -770,8 +770,8 @@ impl<T: 'static> ClassEntity<T> {
770770
/// }
771771
/// ```
772772
#[inline]
773-
pub fn bind_class(&self) -> StateClass<T> {
774-
self.bind_class.clone()
773+
pub fn bound_class(&self) -> StateClass<T> {
774+
self.bound_class.clone()
775775
}
776776
}
777777

@@ -794,7 +794,7 @@ pub struct InterfaceEntity {
794794
method_entities: Vec<MethodEntity>,
795795
constants: Vec<ConstantEntity>,
796796
extends: Vec<Box<dyn Fn() -> &'static ClassEntry>>,
797-
bind_interface: Interface,
797+
bound_interface: Interface,
798798
}
799799

800800
impl InterfaceEntity {
@@ -805,7 +805,7 @@ impl InterfaceEntity {
805805
method_entities: Vec::new(),
806806
constants: Vec::new(),
807807
extends: Vec::new(),
808-
bind_interface: Interface::null(),
808+
bound_interface: Interface::null(),
809809
}
810810
}
811811

@@ -858,7 +858,7 @@ impl InterfaceEntity {
858858
null_mut(),
859859
);
860860

861-
self.bind_interface.bind(class_ce);
861+
self.bound_interface.bind(class_ce);
862862

863863
for interface in &self.extends {
864864
let interface_ce = interface().as_ptr();
@@ -889,8 +889,8 @@ impl InterfaceEntity {
889889

890890
/// Get the bound interface.
891891
#[inline]
892-
pub fn bind_interface(&self) -> Interface {
893-
self.bind_interface.clone()
892+
pub fn bound_interface(&self) -> Interface {
893+
self.bound_interface.clone()
894894
}
895895
}
896896

phper/src/modules.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,17 @@ impl Module {
206206

207207
/// Register class to module.
208208
pub fn add_class<T>(&mut self, class: ClassEntity<T>) -> StateClass<T> {
209-
let bind_class = class.bind_class();
209+
let bound_class = class.bound_class();
210210
self.class_entities
211211
.push(unsafe { transmute::<ClassEntity<T>, ClassEntity<()>>(class) });
212-
bind_class
212+
bound_class
213213
}
214214

215215
/// Register interface to module.
216216
pub fn add_interface(&mut self, interface: InterfaceEntity) -> Interface {
217-
let bind_interface = interface.bind_interface();
217+
let bound_interface = interface.bound_interface();
218218
self.interface_entities.push(interface);
219-
bind_interface
219+
bound_interface
220220
}
221221

222222
/// Register constant to module.

tests/integration/src/classes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn integrate(module: &mut Module) {
3131

3232
fn integrate_a(module: &mut Module) {
3333
let mut class = ClassEntity::new("IntegrationTest\\A");
34-
let integrate_a_class = class.bind_class();
34+
let integrate_a_class = class.bound_class();
3535

3636
class.add_property("name", Visibility::Private, "default");
3737
class.add_property("number", Visibility::Private, 100);

tests/integration/tests/php/classes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
$property_name = $reflection_class->getProperty("name");
3030
assert_true($property_name->isPrivate());
3131

32-
// Test bind_class
32+
// Test bound_class
3333
$a_instance = IntegrationTest\A::newInstance();
3434
assert_true($a_instance instanceof IntegrationTest\A);
3535
assert_eq($a_instance->speak(), "name: default, number: 100");
@@ -104,4 +104,4 @@ class Foo2 extends IntegrationTest\Foo {}
104104
// Test module class extends module class
105105
$bar = new \IntegrationTest\BarExtendsFoo; //Bar should extend Foo
106106
$reflection = new ReflectionClass($bar);
107-
assert_true($reflection->isSubclassOf(IntegrationTest\Foo::class));
107+
assert_true($reflection->isSubclassOf(IntegrationTest\Foo::class));

0 commit comments

Comments
 (0)