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

[5.5] Return condition in throws helpers. #22149

Merged
merged 2 commits into from
Nov 21, 2017

Conversation

mathieutu
Copy link
Contributor

@mathieutu mathieutu commented Nov 20, 2017

Hi, little PR which doesn't change anything except that it returns the condition in throw_* helpers.

Use case:

public function foo() {
        return throw_unless(
            myFunction(),
            new Exception("myFunction result is null")
        );
}

instead of

public function foo() {
        throw_unless(
            $var = myFunction(),
            new Exception("myFunction result is null")
        );

        return $var;
}

Thx.

@mathieutu mathieutu changed the title Return condition in throws helpers. [5.5] Return condition in throws helpers. Nov 20, 2017
@sisve
Copy link
Contributor

sisve commented Nov 21, 2017

The @return void would need to be changed and the tests updated.

@mathieutu
Copy link
Contributor Author

mathieutu commented Nov 21, 2017

Right! the PR was quickly done online, and I totally forgot it.. 🤦‍♂️

Done!

@taylorotwell taylorotwell merged commit 62cf7cb into laravel:5.5 Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants