From f0069939569bda5fe6775d097d9d8eea4e88b7aa Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 11 Oct 2023 09:36:29 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Support/Format.php | 6 +++--- tests/SuccessTest.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Support/Format.php b/src/Support/Format.php index 0457b07..519c71e 100644 --- a/src/Support/Format.php +++ b/src/Support/Format.php @@ -89,7 +89,7 @@ public function data($data, ?string $message, int $code, $errors = null): array public function paginator(AbstractPaginator|AbstractCursorPaginator $resource, $transformer = null, $resourceName = null): array { $fractal = fractal() - ->collection($resource, $transformer ?: fn($item) => $item->toArray(), $resourceName) + ->collection($resource, $transformer ?: fn ($item) => $item->toArray(), $resourceName) ->serializeWith(DataArraySerializer::class); return tap($fractal, $this->formatCollection($resource))->toArray(); @@ -122,7 +122,7 @@ public function resourceCollection(ResourceCollection $collection, $transformer */ public function jsonResource(JsonResource $resource, $transformer = null, $resourceName = null): array { - $data = value($this->formatJsonResource(),$resource); + $data = value($this->formatJsonResource(), $resource); return fractal() ->item($data, $transformer ?: fn () => $data, $resourceName) @@ -190,7 +190,7 @@ protected function formatJsonResource(): \Closure /** * Format paginator data. * - * @param $collection + * @param $collection * @return \Closure */ protected function formatCollection($collection): \Closure diff --git a/tests/SuccessTest.php b/tests/SuccessTest.php index 6b6b2f6..a57926e 100644 --- a/tests/SuccessTest.php +++ b/tests/SuccessTest.php @@ -168,7 +168,7 @@ public function testSuccessWithPaginatedData() $this->assertEquals(200, $response->status()); - $formatData = Arr::map($users->items(),fn($item) => [ + $formatData = Arr::map($users->items(), fn ($item) => [ 'nickname' => $item->name, 'email' => $item->email, ]); @@ -241,7 +241,7 @@ public function testLengthAwarePaginator() $this->assertEquals(200, $response->status()); - $formatData = Arr::map($users->items(),fn($item) => $item->toArray()); + $formatData = Arr::map($users->items(), fn ($item) => $item->toArray()); $data = [ 'data' => $formatData, @@ -279,7 +279,7 @@ public function testSimplePaginator() $this->assertEquals(200, $response->status()); - $formatData = Arr::map($users->items(),fn($item) => $item->toArray()); + $formatData = Arr::map($users->items(), fn ($item) => $item->toArray()); $data = [ 'data' => $formatData, @@ -315,7 +315,7 @@ public function testCursorPaginator() $this->assertEquals(200, $response->status()); - $formatData = Arr::map($users->items(),fn($item) => $item->toArray()); + $formatData = Arr::map($users->items(), fn ($item) => $item->toArray()); $data = [ 'data' => $formatData, @@ -324,7 +324,7 @@ public function testCursorPaginator() 'current' => $users->cursor()?->encode(), 'prev' => $users->previousCursor()?->encode(), 'next' => $users->nextCursor()?->encode(), - 'count' => count($users->items()) + 'count' => count($users->items()), ], ], ];