Skip to content

Commit

Permalink
[5.5] Make Optional@__call really macroable (#20898)
Browse files Browse the repository at this point in the history
We need to firstly check existence of macro and only then pass it to the value. Otherwise it won't be really macroable (because macros won't work for Optional with value inside).
  • Loading branch information
n7olkachev authored and taylorotwell committed Sep 1, 2017
1 parent 5f40dc6 commit 979d693
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Support/Optional.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public function __get($key)
*/
public function __call($method, $parameters)
{
if (is_object($this->value)) {
return $this->value->{$method}(...$parameters);
}

if (static::hasMacro($method)) {
return $this->macroCall($method, $parameters);
}

if (is_object($this->value)) {
return $this->value->{$method}(...$parameters);
}
}
}

0 comments on commit 979d693

Please sign in to comment.