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

[9.x] Conditionable should return HigherOrderWhenProxy only when the args number is exactly 1 #42555

Merged
merged 1 commit into from
May 31, 2022

Conversation

leo108
Copy link
Contributor

@leo108 leo108 commented May 29, 2022

$extraFilter = $condition ? null : function ($query) { $query->where('field', 'value'); };
$query = User::query()->when($extraFilter !== null, $extraFilter);

// When $condition is false, which means $extraFilter is null
// Before: Illuminate\Support\HigherOrderWhenProxy
// After: Illuminate\Database\Eloquent\Builder
dump(get_class($query));

@BrandonSurowiec
Copy link
Contributor

A simple test should be added.

@leo108 leo108 force-pushed the 9.x branch 2 times, most recently from 3f58965 to dddfa50 Compare May 29, 2022 13:32
@leo108
Copy link
Contributor Author

leo108 commented May 29, 2022

@BrandonSurowiec Done

@taylorotwell taylorotwell merged commit 3277687 into laravel:9.x May 31, 2022
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