mirror of
https://github.com/danog/ext-php-rs.git
synced 2025-01-22 04:51:24 +01:00
Fix a few typos
This commit is contained in:
parent
72f39df4fe
commit
4bb0559ab8
@ -170,7 +170,7 @@ Thanks to the contributors for this release:
|
||||
successfully with overwrite.
|
||||
- `push()` now returns a `Result`.
|
||||
- Converting from a `Vec` or `HashMap` to a `ZendHashTable` is fallible, so
|
||||
it now implementes `TryFrom` as opposed to `From`.
|
||||
it now implements `TryFrom` as opposed to `From`.
|
||||
- For `Zval`:
|
||||
- `set_string()` now returns a `Result`, and takes a second parameter
|
||||
(persistent).
|
||||
|
@ -1,5 +1,5 @@
|
||||
// This is a cheeky hack - since we need the list of allowed bindings in both
|
||||
// the build script and in the CLI crate (in differnet formats), we define the
|
||||
// the build script and in the CLI crate (in different formats), we define the
|
||||
// `allowed_bindings.rs` file, which calls a macro called `bind` that doesn't
|
||||
// exist in the bindings file. Which ever script include!s the bindings must
|
||||
// define the `bind` macro. This allows us to have the list in string format
|
||||
|
@ -170,7 +170,7 @@ impl Describe for Function {
|
||||
let name = &self.name;
|
||||
let ret = if let Some((ty, null)) = &self.output {
|
||||
let ty: Type = syn::parse_str(ty)
|
||||
.expect("unreachable - failed to parse previosuly parsed function return type");
|
||||
.expect("unreachable - failed to parse previously parsed function return type");
|
||||
quote! {
|
||||
Some(Retval {
|
||||
ty: <#ty as ::ext_php_rs::convert::IntoZval>::TYPE,
|
||||
@ -300,7 +300,7 @@ impl Describe for crate::method::Method {
|
||||
}
|
||||
});
|
||||
let ret = if let Some((ty, null)) = &self.output {
|
||||
let ty: Type = syn::parse_str(ty).expect("failed to parse previosuly parsed type");
|
||||
let ty: Type = syn::parse_str(ty).expect("failed to parse previously parsed type");
|
||||
quote! {
|
||||
Some(Retval {
|
||||
ty: <#ty as ::ext_php_rs::convert::IntoZval>::TYPE,
|
||||
|
@ -14,7 +14,7 @@ ext-php-rs = { version = "...", features = ["closure"] }
|
||||
|
||||
PHP callables (which includes closures) can be passed to Rust through the
|
||||
`Callable` type. When calling a callable, you must provide it with a `Vec` of
|
||||
arguemnts, all of which must implement `IntoZval` and `Clone`.
|
||||
arguments, all of which must implement `IntoZval` and `Clone`.
|
||||
|
||||
| `T` parameter | `&T` parameter | `T` Return type | `&T` Return type | PHP representation |
|
||||
| ------------- | -------------- | -------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------ |
|
||||
|
@ -62,7 +62,7 @@ impl<T: ZBoxable> ZBox<T> {
|
||||
pub fn into_raw(self) -> &'static mut T {
|
||||
let mut this = ManuallyDrop::new(self);
|
||||
// SAFETY: All constructors ensure the contained pointer is well-aligned and
|
||||
// dereferencable.
|
||||
// dereferenceable.
|
||||
unsafe { this.0.as_mut() }
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ impl<T: ZBoxable> Deref for ZBox<T> {
|
||||
#[inline]
|
||||
fn deref(&self) -> &Self::Target {
|
||||
// SAFETY: All constructors ensure the contained pointer is well-aligned and
|
||||
// dereferencable.
|
||||
// dereferenceable.
|
||||
unsafe { self.0.as_ref() }
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ impl<T: ZBoxable> DerefMut for ZBox<T> {
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
// SAFETY: All constructors ensure the contained pointer is well-aligned and
|
||||
// dereferencable.
|
||||
// dereferenceable.
|
||||
unsafe { self.0.as_mut() }
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ impl ClassBuilder {
|
||||
pub fn new<T: Into<String>>(name: T) -> Self {
|
||||
Self {
|
||||
name: name.into(),
|
||||
// SAFETY: A zeroed class entry is in an initalized state, as it is a raw C type
|
||||
// SAFETY: A zeroed class entry is in an initialized state, as it is a raw C type
|
||||
// whose fields do not have a drop implementation.
|
||||
ce: unsafe { MaybeUninit::zeroed().assume_init() },
|
||||
extends: None,
|
||||
|
@ -96,7 +96,7 @@ impl<'a> FunctionBuilder<'a> {
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `type_` - The return type of the function.
|
||||
/// * `as_ref` - Whether the fucntion returns a reference.
|
||||
/// * `as_ref` - Whether the function returns a reference.
|
||||
/// * `allow_null` - Whether the function return value is nullable.
|
||||
pub fn returns(mut self, type_: DataType, as_ref: bool, allow_null: bool) -> Self {
|
||||
self.retval = Some(type_);
|
||||
|
@ -59,7 +59,7 @@ pub struct ConstructorMeta<T> {
|
||||
pub enum ConstructorResult<T> {
|
||||
/// Successfully constructed the class, contains the new class object.
|
||||
Ok(T),
|
||||
/// An exception occured while constructing the class.
|
||||
/// An exception occurred while constructing the class.
|
||||
Exception(PhpException),
|
||||
/// Invalid arguments were given to the constructor.
|
||||
ArgError,
|
||||
|
@ -75,7 +75,7 @@ where
|
||||
/// let props: HashMap = obj.extract();
|
||||
/// ```
|
||||
///
|
||||
/// Should be functionally equivalent to casting an object to another compatable
|
||||
/// Should be functionally equivalent to casting an object to another compatible
|
||||
/// type.
|
||||
pub trait FromZendObject<'a>: Sized {
|
||||
/// Extracts `Self` from the source `ZendObject`.
|
||||
|
@ -340,7 +340,7 @@ fn split_namespace(class: &str) -> (StdOption<&str>, &str) {
|
||||
/// to be appended. Returns a new string with the new indentation. Will not
|
||||
/// indent whitespace lines.
|
||||
///
|
||||
/// # Paramters
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `s` - The string to indent.
|
||||
/// * `depth` - The depth to indent the lines to, in spaces.
|
||||
|
@ -88,7 +88,8 @@ impl From<anyhow::Error> for PhpException {
|
||||
/// Throws an exception with a given message. See [`ClassEntry`] for some
|
||||
/// built-in exception types.
|
||||
///
|
||||
/// Returns a result containing nothing if the exception was successfully thown.
|
||||
/// Returns a result containing nothing if the exception was successfully
|
||||
/// thrown.
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
@ -109,7 +110,8 @@ pub fn throw(ex: &ClassEntry, message: &str) -> Result<()> {
|
||||
/// Throws an exception with a given message and status code. See [`ClassEntry`]
|
||||
/// for some built-in exception types.
|
||||
///
|
||||
/// Returns a result containing nothing if the exception was successfully thown.
|
||||
/// Returns a result containing nothing if the exception was successfully
|
||||
/// thrown.
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
|
@ -172,7 +172,7 @@ pub use ext_php_rs_derive::php_extern;
|
||||
///
|
||||
/// You are able to implement [`FromZval`] on your own custom types to have
|
||||
/// arguments passed in seamlessly. Similarly, you can implement [`IntoZval`] on
|
||||
/// values that you want to be able to be returned from PHP fucntions.
|
||||
/// values that you want to be able to be returned from PHP functions.
|
||||
///
|
||||
/// Parameters may be deemed optional by passing the parameter name into the
|
||||
/// attribute options. Note that all parameters that are optional (which
|
||||
@ -317,7 +317,7 @@ pub use ext_php_rs_derive::php_function;
|
||||
/// contents of the `impl` block are to be exported to PHP.
|
||||
///
|
||||
/// The only contrary to this is setting the visibility, optional argument and
|
||||
/// default arguments for methods. These are done through seperate macros:
|
||||
/// default arguments for methods. These are done through separate macros:
|
||||
///
|
||||
/// - `#[defaults(key = value, ...)]` for setting defaults of method variables,
|
||||
/// similar to the
|
||||
|
@ -102,7 +102,7 @@ macro_rules! call_user_func {
|
||||
/// ```
|
||||
///
|
||||
/// This example is similar to the one above, apart from the fact that the `z`
|
||||
/// argument is not required. Note the semicolon seperating the first two
|
||||
/// argument is not required. Note the semicolon separating the first two
|
||||
/// arguments from the second.
|
||||
///
|
||||
/// ```
|
||||
|
@ -360,7 +360,7 @@ impl ZendHashTable {
|
||||
}
|
||||
|
||||
/// Pushes an item onto the end of the hash table. Returns a result
|
||||
/// containing nothing if the element was sucessfully inserted.
|
||||
/// containing nothing if the element was successfully inserted.
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
|
@ -42,7 +42,7 @@ impl<'a> ZendCallable<'a> {
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `callable` - TThe underlying [`Zval`] that is callable.
|
||||
/// * `callable` - The underlying [`Zval`] that is callable.
|
||||
pub fn new_owned(callable: Zval) -> Result<Self> {
|
||||
if callable.is_callable() {
|
||||
Ok(Self(OwnedZval::Owned(callable)))
|
||||
|
@ -83,7 +83,7 @@ impl<T: RegisteredClass> ZendClassObject<T> {
|
||||
///
|
||||
/// Providing an initialized variant of [`MaybeUninit<T>`] is safe.
|
||||
///
|
||||
/// Providing an uninitalized variant of [`MaybeUninit<T>`] is unsafe. As
|
||||
/// Providing an uninitialized variant of [`MaybeUninit<T>`] is unsafe. As
|
||||
/// the object is uninitialized, the caller must ensure the following
|
||||
/// until the internal object is initialized:
|
||||
///
|
||||
@ -115,7 +115,7 @@ impl<T: RegisteredClass> ZendClassObject<T> {
|
||||
object_properties_init(&mut obj.std, ce);
|
||||
|
||||
// SAFETY: `obj` is non-null and well aligned as it is a reference.
|
||||
// As the data in `obj.obj` is uninitalized, we don't want to drop
|
||||
// As the data in `obj.obj` is uninitialized, we don't want to drop
|
||||
// the data, but directly override it.
|
||||
ptr::write(&mut obj.obj, val);
|
||||
|
||||
@ -234,7 +234,7 @@ impl<T> Deref for ZendClassObject<T> {
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.obj
|
||||
.as_ref()
|
||||
.expect("Attempted to access uninitalized class object")
|
||||
.expect("Attempted to access uninitialized class object")
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ impl<T> DerefMut for ZendClassObject<T> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
self.obj
|
||||
.as_mut()
|
||||
.expect("Attempted to access uninitalized class object")
|
||||
.expect("Attempted to access uninitialized class object")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ impl ExecuteData {
|
||||
///
|
||||
/// The resultant zval reference has a lifetime equal to the lifetime of
|
||||
/// `self`. This isn't specified because when you attempt to get a
|
||||
/// reference to args and the `$this` object, Rust doesnt't let you.
|
||||
/// reference to args and the `$this` object, Rust doesn't let you.
|
||||
/// Since this is a private method it's up to the caller to ensure the
|
||||
/// lifetime isn't exceeded.
|
||||
#[doc(hidden)]
|
||||
|
@ -98,7 +98,7 @@ impl<'a> PHPProvider<'a> for Provider<'a> {
|
||||
|
||||
/// Returns the path to rustc's linker.
|
||||
fn get_rustc_linker() -> Result<PathBuf> {
|
||||
// `RUSTC_LINKER` is set if the linker has been overriden anywhere.
|
||||
// `RUSTC_LINKER` is set if the linker has been overridden anywhere.
|
||||
if let Ok(link) = std::env::var("RUSTC_LINKER") {
|
||||
return Ok(link.into());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user