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

[11.x] Unnecessary closure wrapping in DatabaseBatchRepository::transaction #51513

Closed
wants to merge 1 commit into from

Conversation

GromNaN
Copy link
Contributor

@GromNaN GromNaN commented May 20, 2024

$callback is already a closure. No need to wrap it.

@GromNaN GromNaN changed the title [11.x] Remove unnecessary closure wrapping in DatabaseBatchRepository::transaction [11.x]Uunnecessary closure wrapping in DatabaseBatchRepository::transaction May 20, 2024
@GromNaN GromNaN changed the title [11.x]Uunnecessary closure wrapping in DatabaseBatchRepository::transaction [11.x] Unnecessary closure wrapping in DatabaseBatchRepository::transaction May 20, 2024
@@ -309,7 +309,7 @@ public function pruneCancelled(DateTimeInterface $before)
*/
public function transaction(Closure $callback)
{
return $this->connection->transaction(fn () => $callback());
return $this->connection->transaction($callback);
Copy link
Member

@crynobone crynobone May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a slight difference between the two.

Before

/** 
 * @param \Closure():(mixed) $callback
 */

After

/**
 * @param \Closure(\Illuminate\Database\Connection):(mixed) $callback
 */

@taylorotwell
Copy link
Member

I am closing this pull request because it lacks sufficient explanation, tests, or both. It is difficult for us to merge pull requests without these things because the change may introduce breaking changes to the framework.

Feel free to re-submit your change with a thorough explanation of the feature and tests - integration tests are preferred over unit tests. Please include it's benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc.

Thanks!

@GromNaN GromNaN deleted the patch-1 branch May 20, 2024 13:19
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.

None yet

3 participants