Skip to content

Commit 0d7f732

Browse files
committed
Better squashing.
1 parent f5f17dc commit 0d7f732

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/Optional.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class Optional
1717
*/
1818
public function __construct($value)
1919
{
20+
if ($value instanceof Optional) {
21+
$value = $value->value();
22+
}
23+
2024
$this->value = $value;
2125
}
2226

@@ -47,10 +51,6 @@ public function __call($method, $parameters)
4751
if (is_callable($callable)) {
4852
$result = $this->callWithParameters($callable, $parameters);
4953

50-
if ($result instanceof Optional) {
51-
$result = $result->value();
52-
}
53-
5454
if ($this->isNotNone($result)) {
5555
return new Optional($result);
5656
}

0 commit comments

Comments
 (0)