Skip to content

Commit

Permalink
fix: league\fractal array serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
jiannei committed Jan 3, 2023
1 parent ee51185 commit c50396a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Support/Serializers/ArraySerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class ArraySerializer extends FractalArraySerializer
/**
* Serialize a collection.
*
* @param string $resourceKey
* @param string|null $resourceKey
* @param array $data
* @return array
*/
public function collection($resourceKey, array $data)
public function collection(?string $resourceKey, array $data):array
{
$paginationDataField = Config::get('response.format.fields.data.fields.data.alias', 'data');

Expand All @@ -37,7 +37,7 @@ public function collection($resourceKey, array $data)
* @param PaginatorInterface $paginator
* @return array
*/
public function paginator(PaginatorInterface $paginator)
public function paginator(PaginatorInterface $paginator): array
{
$currentPage = (int) $paginator->getCurrentPage();
$lastPage = (int) $paginator->getLastPage();
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Serializers/SimpleArraySerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class SimpleArraySerializer extends ArraySerializer
/**
* Serialize a collection.
*
* @param string $resourceKey
* @param string|null $resourceKey
* @param array $data
* @return array
*/
public function collection($resourceKey, array $data)
public function collection(?string $resourceKey, array $data):array
{
return $data;
}
Expand Down

0 comments on commit c50396a

Please sign in to comment.