bingo-functional
bingo-functional copied to clipboard
Fatal error when using Nothing::flatMap
Consider the following code:
$maybe = Maybe::fromValue(null)
->flatMap(function () {
return Maybe::fromValue('some value');
})
->getOrElse('default');
It causes the error: PHP Fatal error: Uncaught Error: Call to a member function getOrElse() on null
. Probably Nothing::flatMap
should return an instance of Nothing
instead of null
.