Skip to content

Commit

Permalink
Merge branch 'update-fractal' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Mar 11, 2024
2 parents 9967ee9 + 78e9206 commit 440a9ba
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Element API

## Unreleased

- Updated Fractal to 0.20. ([#183](https://github.com/craftcms/element-api/pull/183))

## 3.0.1.1 - 2022-07-07

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"prefer-stable": true,
"require": {
"craftcms/cms": "^4.0.0-RC3",
"league/fractal": "^0.18.0"
"league/fractal": "^0.20.1"
},
"require-dev": {
"craftcms/ecs": "dev-main",
Expand Down
26 changes: 14 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/JsonFeedV1Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class JsonFeedV1Serializer extends ArraySerializer
/**
* @inheritdoc
*/
public function collection($resourceKey, array $data)
public function collection($resourceKey, array $data): array
{
return ['items' => $data];
}

/**
* @inheritdoc
*/
public function meta(array $meta)
public function meta(array $meta): array
{
return array_merge([
'version' => 'https://jsonfeed.org/version/1.1',
Expand All @@ -38,7 +38,7 @@ public function meta(array $meta)
/**
* @inheritdoc
*/
public function paginator(PaginatorInterface $paginator)
public function paginator(PaginatorInterface $paginator): array
{
$currentPage = (int)$paginator->getCurrentPage();
$lastPage = (int)$paginator->getLastPage();
Expand Down
12 changes: 6 additions & 6 deletions src/PaginatorAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct($elementsPerPage, $totalElements, $pageParam)
*
* @return int
*/
public function getCurrentPage()
public function getCurrentPage(): int
{
return $this->currentPage;
}
Expand All @@ -75,7 +75,7 @@ public function getCurrentPage()
*
* @return int
*/
public function getLastPage()
public function getLastPage(): int
{
return $this->totalPages;
}
Expand All @@ -85,7 +85,7 @@ public function getLastPage()
*
* @return int
*/
public function getTotal()
public function getTotal(): int
{
return $this->totalElements;
}
Expand All @@ -95,7 +95,7 @@ public function getTotal()
*
* @return int
*/
public function getCount()
public function getCount(): int
{
return $this->count;
}
Expand All @@ -115,7 +115,7 @@ public function setCount($count)
*
* @return int
*/
public function getPerPage()
public function getPerPage(): int
{
return $this->elementsPerPage;
}
Expand All @@ -126,7 +126,7 @@ public function getPerPage()
* @param int $page
* @return string
*/
public function getUrl($page)
public function getUrl($page): string
{
$request = Craft::$app->getRequest();

Expand Down

0 comments on commit 440a9ba

Please sign in to comment.