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

Skip to content

Fix argument types for Illuminate/Database/Query/Builder::upsert() #55849

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 2 commits into from
May 26, 2025

Conversation

jellisii
Copy link
Contributor

Ensures IDE hinting isn't out of order.

ide-hinting-order-issue

@taylorotwell taylorotwell merged commit 6cde2ab into laravel:12.x May 26, 2025
58 of 59 checks passed
@coclav
Copy link

coclav commented Jun 3, 2025

that's quite the breaking change @taylorotwell ?

The documentation states the second argument can be ignored (set to null) this change makes it mandatory

https://laravel.com/docs/11.x/queries#upserts

@AndrewMast
Copy link
Contributor

@coclav Maybe I'm missing it, but I don't see where the documentation says the second argument can be null?

@d8vjork
Copy link
Contributor

d8vjork commented Jun 4, 2025

@AndrewMast His colleague here. The IDE types were wrong as stated here in this PR, but I think he meant the alert box below that upsert part on the docs that have the following:

... In addition, the MariaDB and MySQL database drivers ignore the second argument of the upsert ...

We're fixing these conflicts with these patch releases over Laravel framework this way:

// Error version
Model::upsert($data, null);
Model::query()->upsert($data, null);

// Fixed version
Model::upsert($data, []); // this one version forward to DB builder so should be same as the one below
Model::query()->upsert($data, []); 

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.

5 participants