···140140| `$fn` | **callable** | Function to transform the value |
141141142142***
143143+144144+### mapOr
145145+146146+Calls `fn` on a contained value if `some`, or returns $or if `none`
147147+148148+```php
149149+public mapOr(mixed $or, callable $fn): \Ciarancoza\OptionResult\V|\Ciarancoza\OptionResult\U
150150+```
151151+152152+**Parameters:**
153153+154154+| Parameter | Type | Description |
155155+|-----------|--------------|---------------------------------|
156156+| `$or` | **mixed** | |
157157+| `$fn` | **callable** | Function to transform the value |
158158+159159+***
+17
docs/classes/Ciarancoza/OptionResult/Result.md
···198198199199***
200200201201+### mapOr
202202+203203+Calls `fn` on a contained value if `ok`, or returns $or if `err`
204204+205205+```php
206206+public mapOr(mixed $or, callable $fn): \Ciarancoza\OptionResult\V|\Ciarancoza\OptionResult\U
207207+```
208208+209209+**Parameters:**
210210+211211+| Parameter | Type | Description |
212212+|-----------|--------------|---------------------------------|
213213+| `$or` | **mixed** | |
214214+| `$fn` | **callable** | Function to transform the value |
215215+216216+***
217217+201218### mapErr
202219203220If `err`, transform the error value with `$fn`
+17
src/Option.php
···104104105105 return Option::Some($fn($this->value));
106106 }
107107+108108+ /**
109109+ * Calls `fn` on a contained value if `some`, or returns $or if `none`
110110+ *
111111+ * @template V $or
112112+ * @template U
113113+ *
114114+ * @param callable(T): U $fn Function to transform the value
115115+ * @return V|U
116116+ */
117117+ public function mapOr(mixed $or, callable $fn): mixed
118118+ {
119119+ return match (true) {
120120+ $this->isSome() => $fn($this->unwrap()),
121121+ $this->isNone() => is_callable($or) ? $or() : $or,
122122+ };
123123+ }
107124}
+17
src/Result.php
···161161 }
162162163163 /**
164164+ * Calls `fn` on a contained value if `ok`, or returns $or if `err`
165165+ *
166166+ * @template V $or
167167+ * @template U
168168+ *
169169+ * @param callable(T): U $fn Function to transform the value
170170+ * @return V|U
171171+ */
172172+ public function mapOr(mixed $or, callable $fn): mixed
173173+ {
174174+ return match (true) {
175175+ $this->isOk() => $fn($this->unwrap()),
176176+ $this->isErr() => is_callable($or) ? $or() : $or,
177177+ };
178178+ }
179179+180180+ /**
164181 * If `err`, transform the error value with `$fn`
165182 *
166183 * @template U