Skip to content

Commit 0c92afe

Browse files
committed
fix docs
1 parent 7a54a7a commit 0c92afe

File tree

2 files changed

+8
-6
lines changed
  • phper-doc/doc/_06_module

2 files changed

+8
-6
lines changed

phper-doc/doc/_06_module/_02_register_functions/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ the `count` parameter is no longer long, but a reference.
8686
Arguments can have type-hints, nullability and default values applied. Here we define a function that accepts
8787
a nullable class (in this case, an interface), and a string with a default value:
8888

89-
```rust,no-run
89+
```rust,no_run
9090
use phper::{modules::Module, php_get_module, functions::Argument, echo};
91+
use phper::types::ArgumentTypeHint;
92+
use std::ffi::CString;
9193
9294
#[php_get_module]
9395
pub fn get_module() -> Module {

phper-doc/doc/_06_module/_06_register_class/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ foo.add_static_method(
106106

107107
Methods may add argument and return typehints as per functions. For example:
108108

109-
```rust,no-run
109+
```rust,no_run
110110
use phper::classes::{ClassEntity, ClassEntry, Visibility};
111-
use phper::functions::Argument;
112-
use phper::types::{ArgumentTypeHint, ReturnTypeHint},
111+
use phper::functions::{Argument, ReturnType};
112+
use phper::types::{ArgumentTypeHint, ReturnTypeHint};
113113
114114
let mut foo = ClassEntity::new("Foo");
115115
foo.add_method(
116116
"test",
117117
Visibility::Public,
118-
|_this, _arguments| {
118+
|_this, _arguments| -> phper::Result<()> {
119119
Ok(())
120120
},
121121
)
122122
.argument(Argument::by_val("a_string").with_type_hint(ArgumentTypeHint::String))
123-
.argument(Argument::by_val("an_interface").with_type_hint(ArgumentTypeHint::ClassEntry(String::from(r"\MyNamespace\MyInterface")))))
123+
.argument(Argument::by_val("an_interface").with_type_hint(ArgumentTypeHint::ClassEntry(String::from(r"\MyNamespace\MyInterface"))))
124124
.return_type(ReturnType::by_val(ReturnTypeHint::Bool).allow_null());
125125
```
126126

0 commit comments

Comments
 (0)