From 56468d2915cd4ce62b686428d6a976436e54bf77 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo <1102197+priyadi@users.noreply.github.com> Date: Tue, 11 Jun 2024 01:13:18 +0700 Subject: [PATCH] chore: remove unneeded intermediate interfaces (#72) --- CHANGELOG.md | 4 +++ .../src/Contracts/KeysetPageInterface.php | 27 ------------------- .../src/Contracts/KeysetPageableInterface.php | 27 ------------------- .../src/Internal/KeysetPage.php | 5 ++-- .../src/KeysetPageable.php | 15 +++++------ .../src/Contracts/OffsetPageInterface.php | 27 ------------------- .../src/Contracts/OffsetPageableInterface.php | 27 ------------------- .../src/Internal/OffsetPage.php | 5 ++-- .../src/OffsetPageable.php | 6 ++--- .../src/PagerfantaPageable.php | 6 ++--- ...ageableQueryBuilderAdapterQueryBuilder.php | 1 - ...setPageableSelectableAdapterCollection.php | 1 - ...eableSelectableAdapterEntityRepository.php | 1 - ...setPageableCollectionAdapterCollection.php | 1 - ...OffsetPageablePagerfantaAdapterAdapter.php | 1 - ...setPageableSelectableAdapterCollection.php | 1 - ...PagerfantaSelectableAdapter_Collection.php | 1 - 17 files changed, 21 insertions(+), 135 deletions(-) delete mode 100644 packages/rekapager-keyset-pagination/src/Contracts/KeysetPageInterface.php delete mode 100644 packages/rekapager-keyset-pagination/src/Contracts/KeysetPageableInterface.php delete mode 100644 packages/rekapager-offset-pagination/src/Contracts/OffsetPageInterface.php delete mode 100644 packages/rekapager-offset-pagination/src/Contracts/OffsetPageableInterface.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b1a76b..05c115c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +# 0.10.1 + +* chore: remove unneeded intermediate interfaces + # 0.10.0 * chore: remove TIdentifier template as it feels superfluous in userland diff --git a/packages/rekapager-keyset-pagination/src/Contracts/KeysetPageInterface.php b/packages/rekapager-keyset-pagination/src/Contracts/KeysetPageInterface.php deleted file mode 100644 index 47d86de..0000000 --- a/packages/rekapager-keyset-pagination/src/Contracts/KeysetPageInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -namespace Rekalogika\Rekapager\Keyset\Contracts; - -use Rekalogika\Contracts\Rekapager\PageInterface; - -/** - * Represents a page resulting from a keyset pagination - * - * @template TKey of array-key - * @template T - * @extends PageInterface - */ -interface KeysetPageInterface extends PageInterface -{ -} diff --git a/packages/rekapager-keyset-pagination/src/Contracts/KeysetPageableInterface.php b/packages/rekapager-keyset-pagination/src/Contracts/KeysetPageableInterface.php deleted file mode 100644 index 6097137..0000000 --- a/packages/rekapager-keyset-pagination/src/Contracts/KeysetPageableInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -namespace Rekalogika\Rekapager\Keyset\Contracts; - -use Rekalogika\Contracts\Rekapager\PageableInterface; - -/** - * Represents a collection that can be partitioned into pages - * - * @template TKey of array-key - * @template T - * @extends PageableInterface - */ -interface KeysetPageableInterface extends PageableInterface -{ -} diff --git a/packages/rekapager-keyset-pagination/src/Internal/KeysetPage.php b/packages/rekapager-keyset-pagination/src/Internal/KeysetPage.php index 041ad0d..7cdf40f 100644 --- a/packages/rekapager-keyset-pagination/src/Internal/KeysetPage.php +++ b/packages/rekapager-keyset-pagination/src/Internal/KeysetPage.php @@ -19,7 +19,6 @@ use Rekalogika\Rekapager\Keyset\Contracts\BoundaryType; use Rekalogika\Rekapager\Keyset\Contracts\KeysetItemInterface; use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageIdentifier; -use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageInterface; use Rekalogika\Rekapager\Keyset\KeysetPageable; use Rekalogika\Rekapager\Keyset\KeysetPaginationAdapterInterface; @@ -28,12 +27,12 @@ * * @template TKey of array-key * @template T - * @implements KeysetPageInterface + * @implements PageInterface * @implements \IteratorAggregate * * @internal */ -final class KeysetPage implements KeysetPageInterface, \IteratorAggregate +final class KeysetPage implements PageInterface, \IteratorAggregate { /** * @var null|array> diff --git a/packages/rekapager-keyset-pagination/src/KeysetPageable.php b/packages/rekapager-keyset-pagination/src/KeysetPageable.php index 5c09c20..f0cc347 100644 --- a/packages/rekapager-keyset-pagination/src/KeysetPageable.php +++ b/packages/rekapager-keyset-pagination/src/KeysetPageable.php @@ -14,20 +14,19 @@ namespace Rekalogika\Rekapager\Keyset; use Rekalogika\Contracts\Rekapager\Exception\InvalidArgumentException; +use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Contracts\Rekapager\PageInterface; use Rekalogika\Contracts\Rekapager\Trait\TotalPagesTrait; use Rekalogika\Rekapager\Keyset\Contracts\BoundaryType; -use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageableInterface; use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageIdentifier; -use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageInterface; use Rekalogika\Rekapager\Keyset\Internal\KeysetPage; /** * @template TKey of array-key * @template T - * @implements KeysetPageableInterface + * @implements PageableInterface */ -final class KeysetPageable implements KeysetPageableInterface +final class KeysetPageable implements PageableInterface { use TotalPagesTrait; @@ -77,9 +76,9 @@ public function getPages(): \Traversable } /** - * @return KeysetPageInterface + * @return PageInterface */ - public function getFirstPage(): KeysetPageInterface + public function getFirstPage(): PageInterface { $pageIdentifier = new KeysetPageIdentifier( pageNumber: 1, @@ -98,9 +97,9 @@ public function getFirstPage(): KeysetPageInterface } /** - * @return KeysetPageInterface + * @return PageInterface */ - public function getLastPage(): KeysetPageInterface + public function getLastPage(): PageInterface { $totalPages = $this->getTotalPages(); diff --git a/packages/rekapager-offset-pagination/src/Contracts/OffsetPageInterface.php b/packages/rekapager-offset-pagination/src/Contracts/OffsetPageInterface.php deleted file mode 100644 index cf7b9bc..0000000 --- a/packages/rekapager-offset-pagination/src/Contracts/OffsetPageInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -namespace Rekalogika\Rekapager\Offset\Contracts; - -use Rekalogika\Contracts\Rekapager\PageInterface; - -/** - * Represents a page resulting from an offset pagination - * - * @template TKey of array-key - * @template T - * @extends PageInterface - */ -interface OffsetPageInterface extends PageInterface -{ -} diff --git a/packages/rekapager-offset-pagination/src/Contracts/OffsetPageableInterface.php b/packages/rekapager-offset-pagination/src/Contracts/OffsetPageableInterface.php deleted file mode 100644 index 0c1818a..0000000 --- a/packages/rekapager-offset-pagination/src/Contracts/OffsetPageableInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -namespace Rekalogika\Rekapager\Offset\Contracts; - -use Rekalogika\Contracts\Rekapager\PageableInterface; - -/** - * Represents a collection that can be partitioned into pages - * - * @template TKey of array-key - * @template T - * @extends PageableInterface - */ -interface OffsetPageableInterface extends PageableInterface -{ -} diff --git a/packages/rekapager-offset-pagination/src/Internal/OffsetPage.php b/packages/rekapager-offset-pagination/src/Internal/OffsetPage.php index c69dffb..2c3310a 100644 --- a/packages/rekapager-offset-pagination/src/Internal/OffsetPage.php +++ b/packages/rekapager-offset-pagination/src/Internal/OffsetPage.php @@ -17,7 +17,6 @@ use Rekalogika\Contracts\Rekapager\Exception\OutOfBoundsException; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Contracts\Rekapager\PageInterface; -use Rekalogika\Rekapager\Offset\Contracts\OffsetPageInterface; use Rekalogika\Rekapager\Offset\Contracts\PageNumber; use Rekalogika\Rekapager\Offset\OffsetPageable; use Rekalogika\Rekapager\Offset\OffsetPaginationAdapterInterface; @@ -25,12 +24,12 @@ /** * @template TKey of array-key * @template T - * @implements OffsetPageInterface + * @implements PageInterface * @implements \IteratorAggregate * * @internal */ -final class OffsetPage implements OffsetPageInterface, \IteratorAggregate +final class OffsetPage implements PageInterface, \IteratorAggregate { /** * @var null|array diff --git a/packages/rekapager-offset-pagination/src/OffsetPageable.php b/packages/rekapager-offset-pagination/src/OffsetPageable.php index d0d4589..073cec0 100644 --- a/packages/rekapager-offset-pagination/src/OffsetPageable.php +++ b/packages/rekapager-offset-pagination/src/OffsetPageable.php @@ -14,9 +14,9 @@ namespace Rekalogika\Rekapager\Offset; use Rekalogika\Contracts\Rekapager\Exception\InvalidArgumentException; +use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Contracts\Rekapager\PageInterface; use Rekalogika\Contracts\Rekapager\Trait\TotalPagesTrait; -use Rekalogika\Rekapager\Offset\Contracts\OffsetPageableInterface; use Rekalogika\Rekapager\Offset\Contracts\PageNumber; use Rekalogika\Rekapager\Offset\Internal\NullOffsetPage; use Rekalogika\Rekapager\Offset\Internal\OffsetPage; @@ -24,9 +24,9 @@ /** * @template TKey of array-key * @template T - * @implements OffsetPageableInterface + * @implements PageableInterface */ -final class OffsetPageable implements OffsetPageableInterface +final class OffsetPageable implements PageableInterface { use TotalPagesTrait; diff --git a/packages/rekapager-pagerfanta-adapter/src/PagerfantaPageable.php b/packages/rekapager-pagerfanta-adapter/src/PagerfantaPageable.php index 8fcfea2..ecb88a6 100644 --- a/packages/rekapager-pagerfanta-adapter/src/PagerfantaPageable.php +++ b/packages/rekapager-pagerfanta-adapter/src/PagerfantaPageable.php @@ -14,15 +14,15 @@ namespace Rekalogika\Rekapager\Pagerfanta; use Pagerfanta\PagerfantaInterface; +use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Contracts\Rekapager\PageInterface; -use Rekalogika\Rekapager\Offset\Contracts\OffsetPageableInterface; use Rekalogika\Rekapager\Offset\OffsetPageable; /** * @template T - * @implements OffsetPageableInterface + * @implements PageableInterface */ -final class PagerfantaPageable implements OffsetPageableInterface +final class PagerfantaPageable implements PageableInterface { /** * @var OffsetPageable diff --git a/tests/src/App/PageableGenerator/KeysetPageableQueryBuilderAdapterQueryBuilder.php b/tests/src/App/PageableGenerator/KeysetPageableQueryBuilderAdapterQueryBuilder.php index b1b1517..4854fd4 100644 --- a/tests/src/App/PageableGenerator/KeysetPageableQueryBuilderAdapterQueryBuilder.php +++ b/tests/src/App/PageableGenerator/KeysetPageableQueryBuilderAdapterQueryBuilder.php @@ -16,7 +16,6 @@ use Doctrine\DBAL\Types\Types; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Rekapager\Doctrine\ORM\QueryBuilderAdapter; -use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageIdentifier; use Rekalogika\Rekapager\Keyset\KeysetPageable; use Rekalogika\Rekapager\Tests\App\Contracts\PageableGeneratorInterface; use Rekalogika\Rekapager\Tests\App\Entity\Post; diff --git a/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterCollection.php b/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterCollection.php index c90f550..07b5416 100644 --- a/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterCollection.php +++ b/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterCollection.php @@ -17,7 +17,6 @@ use Doctrine\Common\Collections\Order; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Rekapager\Doctrine\Collections\SelectableAdapter; -use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageIdentifier; use Rekalogika\Rekapager\Keyset\KeysetPageable; use Rekalogika\Rekapager\Tests\App\Contracts\PageableGeneratorInterface; use Rekalogika\Rekapager\Tests\App\Entity\Post; diff --git a/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterEntityRepository.php b/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterEntityRepository.php index 8fbea8f..e40c346 100644 --- a/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterEntityRepository.php +++ b/tests/src/App/PageableGenerator/KeysetPageableSelectableAdapterEntityRepository.php @@ -17,7 +17,6 @@ use Doctrine\Common\Collections\Order; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Rekapager\Doctrine\Collections\SelectableAdapter; -use Rekalogika\Rekapager\Keyset\Contracts\KeysetPageIdentifier; use Rekalogika\Rekapager\Keyset\KeysetPageable; use Rekalogika\Rekapager\Tests\App\Contracts\PageableGeneratorInterface; use Rekalogika\Rekapager\Tests\App\Entity\Post; diff --git a/tests/src/App/PageableGenerator/OffsetPageableCollectionAdapterCollection.php b/tests/src/App/PageableGenerator/OffsetPageableCollectionAdapterCollection.php index fbe0b70..97f3ff5 100644 --- a/tests/src/App/PageableGenerator/OffsetPageableCollectionAdapterCollection.php +++ b/tests/src/App/PageableGenerator/OffsetPageableCollectionAdapterCollection.php @@ -17,7 +17,6 @@ use Rekalogika\Collections\Decorator\LazyMatching\LazyMatchingCollection; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Rekapager\Doctrine\Collections\CollectionAdapter; -use Rekalogika\Rekapager\Offset\Contracts\PageNumber; use Rekalogika\Rekapager\Offset\OffsetPageable; use Rekalogika\Rekapager\Tests\App\Contracts\PageableGeneratorInterface; use Rekalogika\Rekapager\Tests\App\Entity\Post; diff --git a/tests/src/App/PageableGenerator/OffsetPageablePagerfantaAdapterAdapter.php b/tests/src/App/PageableGenerator/OffsetPageablePagerfantaAdapterAdapter.php index a390588..c711cf0 100644 --- a/tests/src/App/PageableGenerator/OffsetPageablePagerfantaAdapterAdapter.php +++ b/tests/src/App/PageableGenerator/OffsetPageablePagerfantaAdapterAdapter.php @@ -16,7 +16,6 @@ use Doctrine\Common\Collections\Criteria; use Pagerfanta\Doctrine\Collections\SelectableAdapter; use Rekalogika\Contracts\Rekapager\PageableInterface; -use Rekalogika\Rekapager\Offset\Contracts\PageNumber; use Rekalogika\Rekapager\Offset\OffsetPageable; use Rekalogika\Rekapager\Pagerfanta\PagerfantaAdapterAdapter; use Rekalogika\Rekapager\Tests\App\Contracts\PageableGeneratorInterface; diff --git a/tests/src/App/PageableGenerator/OffsetPageableSelectableAdapterCollection.php b/tests/src/App/PageableGenerator/OffsetPageableSelectableAdapterCollection.php index 7267ea9..81c2e5e 100644 --- a/tests/src/App/PageableGenerator/OffsetPageableSelectableAdapterCollection.php +++ b/tests/src/App/PageableGenerator/OffsetPageableSelectableAdapterCollection.php @@ -17,7 +17,6 @@ use Doctrine\Common\Collections\Order; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Rekapager\Doctrine\Collections\SelectableAdapter; -use Rekalogika\Rekapager\Offset\Contracts\PageNumber; use Rekalogika\Rekapager\Offset\OffsetPageable; use Rekalogika\Rekapager\Tests\App\Contracts\PageableGeneratorInterface; use Rekalogika\Rekapager\Tests\App\Entity\Post; diff --git a/tests/src/App/PageableGenerator/PagerfantaPageable_Pagerfanta_PagerfantaSelectableAdapter_Collection.php b/tests/src/App/PageableGenerator/PagerfantaPageable_Pagerfanta_PagerfantaSelectableAdapter_Collection.php index 8cc41f6..a180f13 100644 --- a/tests/src/App/PageableGenerator/PagerfantaPageable_Pagerfanta_PagerfantaSelectableAdapter_Collection.php +++ b/tests/src/App/PageableGenerator/PagerfantaPageable_Pagerfanta_PagerfantaSelectableAdapter_Collection.php @@ -17,7 +17,6 @@ use Pagerfanta\Doctrine\Collections\SelectableAdapter; use Pagerfanta\Pagerfanta; use Rekalogika\Contracts\Rekapager\PageableInterface; -use Rekalogika\Rekapager\Offset\Contracts\PageNumber; use Rekalogika\Rekapager\Pagerfanta\PagerfantaPageable; use Rekalogika\Rekapager\Tests\App\Contracts\PageableGeneratorInterface; use Rekalogika\Rekapager\Tests\App\Entity\Post;