Skip to content

Conversation

@browner12
Copy link
Contributor

this is a resubmission with all tests passing.

this removes unnecessary calls of the with() helper function. when we have a known closure, we can get the same result with much simpler code.

this reduces the call stack, and simplifies the opcodes necessary for this code.

when we have a well defined closure, there is no reason to use the `with()` helper, or even the closure at all. in most cases, but using a temporary variable we achieve the same effect with arguably cleaner easier to read code.
I can't figure out how to fix the tests right now, so reverting these
@taylorotwell taylorotwell merged commit 7acea81 into laravel:12.x Sep 12, 2025
65 checks passed
@browner12 browner12 deleted the AB-with-call-simplification-v2 branch September 12, 2025 19:47
tegos pushed a commit to tegos/laravel-framework that referenced this pull request Sep 28, 2025
* remove unecessary `with()` helper calls

when we have a well defined closure, there is no reason to use the `with()` helper, or even the closure at all. in most cases, but using a temporary variable we achieve the same effect with arguably cleaner easier to read code.

* style fixes

* revert refactor

I can't figure out how to fix the tests right now, so reverting these
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