Skip to content

Commit f5f17dc

Browse files
committed
Adding optional value squashing.
1 parent 4e918a6 commit f5f17dc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

source/Optional.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function __call($method, $parameters)
4747
if (is_callable($callable)) {
4848
$result = $this->callWithParameters($callable, $parameters);
4949

50+
if ($result instanceof Optional) {
51+
$result = $result->value();
52+
}
53+
5054
if ($this->isNotNone($result)) {
5155
return new Optional($result);
5256
}

0 commit comments

Comments
 (0)