Skip to content

Commit 35808d9

Browse files
committed
Updated inline documentation
1 parent 45c7242 commit 35808d9

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

src/macros.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ macro_rules! _info_table_row {
5151
///
5252
/// # Parameters
5353
///
54-
/// * `$fn` - The 'function' to call. Can be an [Arg](crate::php::args::Arg) or a
55-
/// [Zval](crate::php::types::zval::Zval).
54+
/// * `$fn` - The 'function' to call. Can be an [`Arg`](crate::php::args::Arg) or a
55+
/// [`Zval`](crate::php::types::zval::Zval).
5656
/// * ...`$param` - The parameters to pass to the function. Must be able to be converted into a
57-
/// (crate::php::types::zval::Zval).
57+
/// [`Zval`](crate::php::types::zval::Zval).
5858
#[macro_export]
5959
macro_rules! call_user_func {
6060
($fn: expr, $($param: expr),*) => {
6161
$fn.try_call(vec![$($param.into()),*])
6262
};
6363
}
6464

65-
/// Parses a given list of arguments using the [ArgParser](crate::php::args::ArgParser) class.
65+
/// Parses a given list of arguments using the [`ArgParser`](crate::php::args::ArgParser) class.
6666
///
6767
/// # Examples
6868
///

src/php/class.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ impl<'a> ClassBuilder<'a> {
144144
/// # Parameters
145145
///
146146
/// * `T` - The type which will override the Zend object. Must implement [`ZendObjectOverride`]
147-
/// which can be implemented through the [`object_override_handler`] macro.
147+
/// which can be derived through the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler)
148+
/// derive macro.
148149
pub fn object_override<T: ZendObjectOverride>(mut self) -> Self {
149150
self.object_override = Some(T::create_object);
150151
self

src/php/types/object.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use crate::{
1717
pub type ZendObject = zend_object;
1818
pub type ZendObjectHandlers = zend_object_handlers;
1919

20-
/// Implemented by the [`object_override_handler`] macro on a type T which is used as the T type
21-
/// for [`ZendClassObject`].
20+
/// Implemented by the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) macro on a type T
21+
/// which is used as the T type for [`ZendClassObject`].
2222
/// Implements a function `create_object` which is passed to a PHP class entry to instantiate the
2323
/// object that will represent an object.
2424
pub trait ZendObjectOverride {
@@ -42,12 +42,11 @@ pub struct ZendClassObject<T: Default> {
4242
}
4343

4444
impl<T: Default> ZendClassObject<T> {
45-
/// Allocates a new object when an instance of the class is created
46-
/// in the PHP world.
45+
/// Allocates a new object when an instance of the class is created in the PHP world.
4746
///
4847
/// Internal function. The end user functions are generated by the
49-
/// [`object_override_handler`] macro which generates a function that
50-
/// wraps this function to be exported to C.
48+
/// [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) derive macro which generates a
49+
/// function that wraps this function to be exported to C.
5150
///
5251
/// # Parameters
5352
///
@@ -56,13 +55,10 @@ impl<T: Default> ZendClassObject<T> {
5655
///
5756
/// # Safety
5857
///
59-
/// This function is an internal function which is called only from
60-
/// the function generated by the [`object_override_handler`] macro,
61-
/// which in turn is called from the PHP runtime. PHP guarantees that
62-
/// the given [`ClassEntry`] is valid. The `handlers` to this function
63-
/// are also initialized by the [`object_handlers_init`] macro.
64-
/// However, we cannot ensure the user will call both of these macros
65-
/// in the same place.
58+
/// This function is an internal function which is only called from code which is derived using
59+
/// the [`ZendObjectHandler`](ext_php_rs_derive::ZendObjectHandler) derive macro. PHP will
60+
/// guarantee that any pointers given to this function will be valid, therefore we can Unwrap
61+
/// them with safety.
6662
pub unsafe fn new_ptr(
6763
ce: *mut ClassEntry,
6864
handlers: *mut ZendObjectHandlers,

0 commit comments

Comments
 (0)