Skip to content

Commit

Permalink
Merge pull request #150 from striezel-stash/fix-typos
Browse files Browse the repository at this point in the history
Fix a few typos
  • Loading branch information
TobiasBengtsson authored Sep 12, 2022
2 parents 72f39df + 4bb0559 commit 8f1cfec
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion allowed_bindings.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/macros/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion guide/src/types/closure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| ------------- | -------------- | -------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------ |
Expand Down
6 changes: 3 additions & 3 deletions src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}
}
Expand All @@ -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() }
}
}
Expand All @@ -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() }
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/builders/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/builders/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down
2 changes: 1 addition & 1 deletion src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion src/describe/stub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions src/exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -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
///
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
2 changes: 1 addition & 1 deletion src/types/callable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
8 changes: 4 additions & 4 deletions src/types/class_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
///
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -234,15 +234,15 @@ 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")
}
}

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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/zend/ex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion windows_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 8f1cfec

Please sign in to comment.