none() public static method

public static none ( )
Exemplo n.º 1
0
 public function testNoneFilter()
 {
     $expect = 13;
     $f = function ($input) {
         $this->fail();
     };
     $ifSome = function ($input) {
         $this->fail();
     };
     $ifNone = function () use($expect) {
         return $expect;
     };
     $actual = Option::none()->filter($f)->match($ifSome, $ifNone);
     $this->assertEquals($expect, $actual);
 }
Exemplo n.º 2
0
 public function map(callable $f)
 {
     return $this->has_value ? Option::some($f($this->value)) : Option::none();
 }