diff --git a/src/PhpOption/Option.php b/src/PhpOption/Option.php index bdc215f..c69e43a 100644 --- a/src/PhpOption/Option.php +++ b/src/PhpOption/Option.php @@ -93,7 +93,7 @@ public static function fromArraysValue($array, $key) */ public static function fromReturn($callback, array $arguments = [], $noneValue = null) { - return new LazyOption(function () use ($callback, $arguments, $noneValue) { + return new LazyOption(static function () use ($callback, $arguments, $noneValue) { /** @var mixed */ $return = call_user_func_array($callback, $arguments); @@ -126,7 +126,7 @@ public static function ensure($value, $noneValue = null) if ($value instanceof self) { return $value; } elseif (is_callable($value)) { - return new LazyOption(function () use ($value, $noneValue) { + return new LazyOption(static function () use ($value, $noneValue) { /** @var mixed */ $return = $value(); @@ -159,14 +159,14 @@ public static function ensure($value, $noneValue = null) */ public static function lift($callback, $noneValue = null) { - return function () use ($callback, $noneValue) { + return static function () use ($callback, $noneValue) { /** @var array */ $args = func_get_args(); $reduced_args = array_reduce( $args, /** @param bool $status */ - function ($status, self $o) { + static function ($status, self $o) { return $o->isEmpty() ? true : $status; }, false @@ -178,7 +178,7 @@ function ($status, self $o) { $args = array_map( /** @return T */ - function (self $o) { + static function (self $o) { // it is safe to do so because the fold above checked // that all arguments are of type Some /** @var T */