Skip to content

Commit 1e94d76

Browse files
authored
Fix example in Option documentation (#62)
docs: fix Option example
1 parent 680512c commit 1e94d76

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Read the [documentation](https://doc.maybe.texthtml.net) full API description, d
2828
* @return Option<float>
2929
*/
3030
function divide(float $numerator, float $denominator): Option {
31-
return match ($denomintor) {
31+
return match ($denominator) {
3232
0.0 => Option\none(),
3333
default => Option\some($numerator / $denominator),
3434
};
@@ -40,7 +40,7 @@ $result = divide(2.0, 3.0);
4040
// Pattern match to retrieve the value
4141
if ($result->isSome()) {
4242
// The division was valid
43-
echo "Result: {$option->unwrap()}";
43+
echo "Result: {$result->unwrap()}";
4444
} else {
4545
// The division was invalid
4646
echo "Cannot divide by 0";

tools/apigen/theme/pages/index.latte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
* @param Option<float>
4242
*/
4343
function divide(float $numerator, float $denominator): Option {
44-
return match ($denomintor) {
44+
return match ($denominator) {
4545
0.0 => Option\none(),
46-
_ => Option\some($numerator / $denominator)
46+
default => Option\some($numerator / $denominator),
4747
};
4848
}
4949

@@ -53,7 +53,7 @@ $result = divide(2.0, 3.0);
5353
// Pattern match to retrieve the value
5454
if ($result instanceof Option\Some) {
5555
// The division was valid
56-
echo "Result: {$option->unwrap()}");
56+
echo "Result: {$result->unwrap()}";
5757
} else {
5858
// The division was invalid
5959
echo "Cannot divide by 0";

0 commit comments

Comments
 (0)