Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[12.x] Typehints for bindings #55633

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

Merged
merged 1 commit into from
May 5, 2025

Conversation

cosmastech
Copy link
Contributor

@cosmastech cosmastech commented May 2, 2025

To aid in static analysis when setting bindings. This is especially important for someone who is building an insertUsing() call.

FavoritePodcast::query()->insertUsing(
    ['id', 'created_at', 'user_id'],
    Podcast::query()
        ->where('category_id', 123)
        ->select(['id', DB::raw('? as created_at'), DB::raw('? as user_id')])
        ->addBindings(
            [now(), $user->id],
            'select' // this will now give me a static analysis warning if I input something bogus, and it's much easier to discover what the acceptable values are
        )
);

@taylorotwell taylorotwell merged commit 1dda463 into laravel:12.x May 5, 2025
40 of 60 checks passed
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.

2 participants