Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use result objects instead of multiple return values #9

Open
mallorydxw opened this issue Mar 9, 2016 · 0 comments
Open

Use result objects instead of multiple return values #9

mallorydxw opened this issue Mar 9, 2016 · 0 comments

Comments

@mallorydxw
Copy link
Contributor

mallorydxw commented Mar 9, 2016

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant