From 51a85f138b9f38db1520205c0f33754f6a0a43dc Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Tue, 30 Aug 2016 17:33:53 +0200 Subject: [PATCH] Let setData handles data transformation (#15137) --- src/Illuminate/Routing/ResponseFactory.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Routing/ResponseFactory.php b/src/Illuminate/Routing/ResponseFactory.php index 8cc78e7601fc..8208135500ba 100644 --- a/src/Illuminate/Routing/ResponseFactory.php +++ b/src/Illuminate/Routing/ResponseFactory.php @@ -2,12 +2,10 @@ namespace Illuminate\Routing; -use JsonSerializable; use Illuminate\Support\Str; use Illuminate\Http\Response; use Illuminate\Http\JsonResponse; use Illuminate\Support\Traits\Macroable; -use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\View\Factory as ViewFactory; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\BinaryFileResponse; @@ -74,7 +72,7 @@ public function view($view, $data = [], $status = 200, array $headers = []) /** * Return a new JSON response from the application. * - * @param string|array $data + * @param mixed $data * @param int $status * @param array $headers * @param int $options @@ -82,10 +80,6 @@ public function view($view, $data = [], $status = 200, array $headers = []) */ public function json($data = [], $status = 200, array $headers = [], $options = 0) { - if ($data instanceof Arrayable && ! $data instanceof JsonSerializable) { - $data = $data->toArray(); - } - return new JsonResponse($data, $status, $headers, $options); } @@ -93,7 +87,7 @@ public function json($data = [], $status = 200, array $headers = [], $options = * Return a new JSONP response from the application. * * @param string $callback - * @param string|array $data + * @param mixed $data * @param int $status * @param array $headers * @param int $options