Skip to content

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