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] Remove useless variable assignment #51838

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

seriquynh
Copy link
Contributor

The $request variable inside Illuminate\Http\Resources\Json\JsonResource::resolve() is useless, so I remove it.

public function resolve($request = null)
{
    $data = $this->toArray(
        // It's unneeded to re-assign $request here.
        $request = $request ?: Container::getInstance()->make('request')
    );

    if ($data instanceof Arrayable) {
        $data = $data->toArray();
    } elseif ($data instanceof JsonSerializable) {
        $data = $data->jsonSerialize();
    }

    return $this->filter((array) $data);
}

@taylorotwell taylorotwell merged commit 6be71e1 into laravel:11.x Jun 19, 2024
30 checks passed
@seriquynh seriquynh deleted the remove-useless-variable branch June 19, 2024 16:28
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