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

Improve docblock for with() method to clarify it adds to existing eag… #54838

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

igorlealantunes
Copy link
Contributor

The previous docblock for the with() method wasn't entirely clear on whether it set and replaced the existing eager loading list or appended to it. I had to read the source code instead of just the docblock.

This update clarifies that calling with() adds to the existing list rather than overwriting it.

igorlealantunes and others added 3 commits February 27, 2025 19:02
…er loads

The previous docblock for the with() method wasn't entirely clear on whether it set and replaced the existing eager loading list or appended to it. I had to read the source code instead of just the docblock.

This update clarifies that calling with() adds to the existing list rather than overwriting it.
@taylorotwell taylorotwell merged commit b7254f9 into laravel:12.x Feb 27, 2025
12 checks passed
@shaedrich
Copy link
Contributor

shaedrich commented Feb 27, 2025

The previous docblock for the with() method wasn't entirely clear on whether it set and replaced the existing eager loading list or appended to it.

- * Set the relationships that should be eager loaded.
+ * Specify relationships that should be eager loaded.

Am I missing something here? The docblock literally said "set"—how is "specify" more precise? oO

@igorlealantunes
Copy link
Contributor Author

I feel that "Set" implies replacing existing relationships, "Specify" is better. However, "Adds to" is the clearest option IMO

@shaedrich
Copy link
Contributor

shaedrich commented Mar 1, 2025

Yeah, I agree with you on the perceived meaning of "set", but "specify" doesn't really have such an agreed upon meaning as far as I know. What about "add"?

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