diff --git a/CHANGELOG.md b/CHANGELOG.md index f3236ef..bffd0e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ - Bug #195: Fix invalid count in `IterableDataReader` when limit or/and offset used (@vjik) - Enh #201: Disable sorting when limit is set explicitly in a paginator (@samdark) - Enh #202: Check that correct sort is passed to `withSort()` of keyset paginator (@samdark) +- Enh #207: More specific Psalm type for `OffsetPaginator::withCurrentPage()` (@samdark) +- Enh #214: Improved interface hierarchy (@samdark) - Enh #207: More specific Psalm type for `OffsetPaginator::withCurrentPage()` parameter (@samdark) - Enh #210: More specific Psalm type for `PaginatorInterface::getPageSize()` result (@vjik) diff --git a/src/Paginator/OffsetPaginator.php b/src/Paginator/OffsetPaginator.php index 8021197..addebdc 100644 --- a/src/Paginator/OffsetPaginator.php +++ b/src/Paginator/OffsetPaginator.php @@ -56,7 +56,7 @@ final class OffsetPaginator implements PaginatorInterface /** * Data reader being paginated. * - * @psalm-var ReadableDataInterface&LimitableDataInterface&OffsetableDataInterface&CountableDataInterface + * @psalm-var ReadableDataInterface&LimitableDataInterface&OffsetableDataInterface&CountableDataInterface */ private ReadableDataInterface $dataReader; diff --git a/src/Reader/DataReaderInterface.php b/src/Reader/DataReaderInterface.php index e266da5..4cb9f9d 100644 --- a/src/Reader/DataReaderInterface.php +++ b/src/Reader/DataReaderInterface.php @@ -19,11 +19,13 @@ * @template TKey as array-key * @template TValue as array|object * - * @extends ReadableDataInterface + * @extends LimitableDataInterface + * @extends OffsetableDataInterface + * @extends SortableDataInterface + * @extends FilterableDataInterface * @extends IteratorAggregate */ interface DataReaderInterface extends - ReadableDataInterface, LimitableDataInterface, OffsetableDataInterface, CountableDataInterface, diff --git a/src/Reader/FilterableDataInterface.php b/src/Reader/FilterableDataInterface.php index b83d04e..d6b46b0 100644 --- a/src/Reader/FilterableDataInterface.php +++ b/src/Reader/FilterableDataInterface.php @@ -14,8 +14,13 @@ * {@see FilterInterface::getOperator()} is applied * * For performance reasons, prefer filtering as many items as possible in the first step. + * + * @template TKey as array-key + * @template TValue as array|object + * + * @extends ReadableDataInterface */ -interface FilterableDataInterface +interface FilterableDataInterface extends ReadableDataInterface { /** * Returns new instance with data reading criteria set. diff --git a/src/Reader/LimitableDataInterface.php b/src/Reader/LimitableDataInterface.php index 4d07fde..dde7edb 100644 --- a/src/Reader/LimitableDataInterface.php +++ b/src/Reader/LimitableDataInterface.php @@ -8,8 +8,13 @@ /** * Data that could be limited. + * + * @template TKey as array-key + * @template TValue as array|object + * + * @extends ReadableDataInterface */ -interface LimitableDataInterface +interface LimitableDataInterface extends ReadableDataInterface { /** * Get a new instance with the limit set. diff --git a/src/Reader/OffsetableDataInterface.php b/src/Reader/OffsetableDataInterface.php index e13c6d2..cfd5b58 100644 --- a/src/Reader/OffsetableDataInterface.php +++ b/src/Reader/OffsetableDataInterface.php @@ -6,8 +6,13 @@ /** * Data that could be read from Nth item by skipping items from the beginning. + * + * @template TKey as array-key + * @template TValue as array|object + * + * @extends ReadableDataInterface */ -interface OffsetableDataInterface +interface OffsetableDataInterface extends ReadableDataInterface { /** * Get a new instance with an offset set. diff --git a/src/Reader/SortableDataInterface.php b/src/Reader/SortableDataInterface.php index 611d0f9..2d69d01 100644 --- a/src/Reader/SortableDataInterface.php +++ b/src/Reader/SortableDataInterface.php @@ -7,8 +7,13 @@ /** * A data set that could be sorted. * The sorting set may be used by a data reader that supports sorting. + * + * @template TKey as array-key + * @template TValue as array|object + * + * @extends ReadableDataInterface */ -interface SortableDataInterface +interface SortableDataInterface extends ReadableDataInterface { /** * Get a new instance with a sorting set.