Skip to content

Conversation

@fftfaisal
Copy link
Contributor

I am not sure why array_merge() is used with the array spread operator. It may not be necessary. Can't we simply use the array spread operator?

Before

return array_merge(parent::share($request), [
    ...parent::share($request),
    'name' => config('app.name'),
    'quote' => ['message' => trim($message), 'author' => trim($author)],
    'auth' => [
        'user' => $request->user(),
    ],
]);

After

return [
    ...parent::share($request),
    'name' => config('app.name'),
    'quote' => ['message' => trim($message), 'author' => trim($author)],
    'auth' => [
        'user' => $request->user(),
    ],
];

@taylorotwell taylorotwell merged commit 254fc9c into laravel:main Feb 24, 2025
2 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