From 2fd6767f14ff94ff94f627e12ef48d7e7c5e3f51 Mon Sep 17 00:00:00 2001 From: Moln Date: Sun, 12 Feb 2023 03:01:18 +0800 Subject: [PATCH] Fix PHP8.1 typing --- src/Paginator/CursorPaginator.php | 4 +++- src/Paginator/Paginator.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Paginator/CursorPaginator.php b/src/Paginator/CursorPaginator.php index 7a87553..9bcb816 100644 --- a/src/Paginator/CursorPaginator.php +++ b/src/Paginator/CursorPaginator.php @@ -3,6 +3,8 @@ namespace Zfegg\ApiSerializerExt\Paginator; +use Traversable; + class CursorPaginator implements CursorPaginatorInterface { use CursorPropertyTrait; @@ -23,7 +25,7 @@ public function __construct( $this->itemsPerPage = $itemsPerPage; } - public function getIterator() + public function getIterator(): Traversable { foreach ($this->data as $item) { yield $item; diff --git a/src/Paginator/Paginator.php b/src/Paginator/Paginator.php index 0dfaa21..73f9846 100644 --- a/src/Paginator/Paginator.php +++ b/src/Paginator/Paginator.php @@ -22,12 +22,12 @@ public function __construct(iterable $data, int $count, int $currentPage = 1, in $this->itemsPerPage = $itemsPerPage; } - public function getIterator() + public function getIterator(): Traversable { return new \ArrayIterator($this->data); } - public function count() + public function count(): int { return $this->count; }