Skip to content

Commit 1e88f99

Browse files
authored
Merge pull request #316 from Matth--/template-interface
Add template docblocks for pagination
2 parents fc88b70 + 08423c1 commit 1e88f99

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/Knp/Component/Pager/Pagination/AbstractPagination.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
use Iterator;
66

7+
/**
8+
* @template TKey
9+
* @template TValue
10+
*
11+
* @template-implements PaginationInterface<TKey, TValue>
12+
*/
713
abstract class AbstractPagination implements Iterator, PaginationInterface
814
{
915
protected ?int $currentPageNumber = null;

src/Knp/Component/Pager/Pagination/PaginationInterface.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* Pagination interface strictly defines
99
* the methods - paginator will use to populate the
1010
* pagination data
11+
*
12+
* @template TKey
13+
* @template TValue
14+
*
15+
* @template-extends Traversable<TKey, TValue>
1116
*/
1217
interface PaginationInterface extends Countable, Traversable, ArrayAccess
1318
{
@@ -32,10 +37,15 @@ public function setTotalItemCount(int $numTotal): void;
3237
*/
3338
public function getTotalItemCount(): int;
3439

40+
/**
41+
* @param iterable<TKey, TValue> $items
42+
*/
3543
public function setItems(iterable $items): void;
3644

3745
/**
3846
* Get current items
47+
*
48+
* @return iterable<TKey, TValue>
3949
*/
4050
public function getItems(): iterable;
4151

src/Knp/Component/Pager/Pagination/SlidingPagination.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* @todo: find a way to avoid exposing private member setters
99
*
1010
* Sliding pagination
11+
*
12+
* @template TKey
13+
* @template TValue
14+
*
15+
* @template-extends AbstractPagination<TKey, TValue>
1116
*/
1217
final class SlidingPagination extends AbstractPagination
1318
{

0 commit comments

Comments
 (0)