Skip to content

Conversation

@seriquynh
Copy link
Contributor

Laravel 9 will require PHP 8.0 as the minimum version, so we are free to use match expression. In this PR, I try to convert a few switch statements into match expressions that makes code easier to read.

Please review the code changes and see how nice the match expression is.

return match ($driver) {
'database' => $this->createDatabaseProvider($config),
'eloquent' => $this->createEloquentProvider($config),
default => (throw new InvalidArgumentException(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the throw wrapped in parentheses?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are not necessary. I removed them.

@taylorotwell taylorotwell merged commit 23cdfcf into laravel:master Nov 15, 2021
@driesvints
Copy link
Member

@seriquynh this seem to have broken the default null return in a couple of places: #40880

@seriquynh
Copy link
Contributor Author

@driesvints I'm sorry for missing your mention because I haven't check github for a while. I see a fixed PR has been merged. Thanks for you guys!

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