From 848a8df42d9fb00a8840acf22b5006b99a6a8906 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 18 May 2021 16:18:49 +0930 Subject: [PATCH] Fix noLimit method --- src/Endpoint/Index.php | 2 +- src/Schema/Type.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Endpoint/Index.php b/src/Endpoint/Index.php index 1a462b0..9f3eb27 100644 --- a/src/Endpoint/Index.php +++ b/src/Endpoint/Index.php @@ -142,7 +142,7 @@ class Index $paginationLinks[] = new PrevLink($this->buildUrl($request, $params)); } - if ($schema->isCountable() && $schema->getPerPage() && $offset + $limit < $total) { + if ($schema->isCountable() && $schema->getPerPage() && $limit && $offset + $limit < $total) { $paginationLinks[] = new LastLink($this->buildUrl($request, ['page' => ['offset' => floor(($total - 1) / $limit) * $limit]])); } diff --git a/src/Schema/Type.php b/src/Schema/Type.php index 8101000..b5cef04 100644 --- a/src/Schema/Type.php +++ b/src/Schema/Type.php @@ -174,7 +174,7 @@ final class Type * Get the maximum number of records that can be listed, or null if there * is no limit. */ - public function getLimit(): int + public function getLimit(): ?int { return $this->limit; }