Skip to content

Use result objects instead of multiple return values #9

@mallorydxw

Description

@mallorydxw

Multiple return values is not commonly used in PHP. It's really more of a Go idiom to use the last returned value as an error. So this would be more idiomatic and more verbose and thus easier to comprehend.

composer require dxw/result

i.e.

return \Dxw\Result\Result:ok($data);
return \Dxw\Result\Result::err($error);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions