From 7f5d8bc70d23607cbab9a8c925b43a0e413cedfe Mon Sep 17 00:00:00 2001 From: xwiz Date: Fri, 19 Jun 2020 16:13:21 +0100 Subject: [PATCH] Make transformer parameter nullable Make transformer parameter nullable for paginator/collection --- src/Http/Response/Factory.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Http/Response/Factory.php b/src/Http/Response/Factory.php index aa6caa690..093b9d0a0 100644 --- a/src/Http/Response/Factory.php +++ b/src/Http/Response/Factory.php @@ -118,14 +118,14 @@ public function collection(Collection $collection, $transformer = null, $paramet /** * Bind an item to a transformer and start building a response. * - * @param object $item - * @param string|callable|object $transformer - * @param array $parameters - * @param \Closure $after + * @param object $item + * @param null|string|callable|object $transformer + * @param array $parameters + * @param \Closure $after * * @return \Dingo\Api\Http\Response */ - public function item($item, $transformer, $parameters = [], Closure $after = null) + public function item($item, $transformer = null, $parameters = [], Closure $after = null) { $class = get_class($item); @@ -147,13 +147,13 @@ public function item($item, $transformer, $parameters = [], Closure $after = nul * Bind a paginator to a transformer and start building a response. * * @param \Illuminate\Contracts\Pagination\Paginator $paginator - * @param string|callable|object $transformer + * @param null|string|callable|object $transformer * @param array $parameters * @param \Closure $after * * @return \Dingo\Api\Http\Response */ - public function paginator(Paginator $paginator, $transformer, array $parameters = [], Closure $after = null) + public function paginator(Paginator $paginator, $transformer = null, array $parameters = [], Closure $after = null) { if ($paginator->isEmpty()) { $class = get_class($paginator);