public function testToList()
 {
     $just = Maybe\Maybe(10);
     $nothing = Maybe\Maybe(null);
     $this->assertEquals([10], $just->toList());
     $this->assertEquals([], $nothing->toList());
 }
 public function hello($def = 'Unknown')
 {
     $user = new User(Maybe\Maybe($this->name)->fromMaybe($def));
     return sprintf('Hello, %s', $user->getName());
 }
 public function findByName($name, User $def = null)
 {
     $user = $this->em->find(User::class, $name);
     return Maybe\Maybe($user)->fromMaybe($def ?: new User('None'));
 }