We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5f17dc commit 0d7f732Copy full SHA for 0d7f732
source/Optional.php
@@ -17,6 +17,10 @@ class Optional
17
*/
18
public function __construct($value)
19
{
20
+ if ($value instanceof Optional) {
21
+ $value = $value->value();
22
+ }
23
+
24
$this->value = $value;
25
}
26
@@ -47,10 +51,6 @@ public function __call($method, $parameters)
47
51
if (is_callable($callable)) {
48
52
$result = $this->callWithParameters($callable, $parameters);
49
53
50
- if ($result instanceof Optional) {
- $result = $result->value();
- }
-
54
if ($this->isNotNone($result)) {
55
return new Optional($result);
56
0 commit comments