Skip to content

Fatal error when using Nothing::flatMap #29

@OlexandrPopov

Description

@OlexandrPopov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions