public function testFromReturn() { $null = function () { return null; }; $false = function () { return false; }; $some = function () { return 'foo'; }; $this->assertTrue(\PhpOption\Option::fromReturn($null)->isEmpty()); $this->assertFalse(\PhpOption\Option::fromReturn($false)->isEmpty()); $this->assertTrue(\PhpOption\Option::fromReturn($false, array(), false)->isEmpty()); $this->assertTrue(\PhpOption\Option::fromReturn($some)->isDefined()); $this->assertFalse(\PhpOption\Option::fromReturn($some, array(), 'foo')->isDefined()); }
public function getOptionResult($hydrationMode = null) { return Option::fromReturn(array($this, 'getOneOrNullResult'), array($hydrationMode)); }