From 4bfaa1223948af8f30ae0e92a3948d9ce1e2f65b Mon Sep 17 00:00:00 2001 From: agis Date: Tue, 15 Sep 2026 17:20:19 +0700 Subject: [PATCH] refactor(pagination): rename Paginator getters to L13 names (task 2.15, part 1) Converge the app-facing Paginator accessors to the L13 surface (strict-mode: old getters removed -> method-not-found forces app/template conform): getCurrentPage -> currentPage getLastPage -> lastPage getFrom -> firstItem getTo -> lastItem getPerPage -> perPage getTotal -> total getItems -> items Update fork-internal Paginator callers: Presenter, the 3 bundled view templates, BelongsToMany::paginate hydration, and the Pagination tests. links() unchanged. The pagination Factory keeps its own getCurrentPage() (internal wiring), untouched here. Ratchet: pagination_getters 15 -> 10 (the 5 remaining are Factory getCurrentPage() calls in Query/Eloquent Builder). Baseline updated. Deferred to the Database-entangled window (task 2.5): removing the pagination Factory + Presenter/BootstrapPresenter and dropping the Paginator $factory ctor arg -- those rewire ->paginate() across Connection/Query\Builder/ Eloquent\Builder, so they ship with the Database work, not here. Tests: tests/Pagination green (40), Database builder/relation tests green. Co-Authored-By: Claude Opus 4.8 (1M context) --- ci/convergence-baseline.txt | 2 +- .../Eloquent/Relations/BelongsToMany.php | 2 +- src/Illuminate/Pagination/Paginator.php | 14 +++--- src/Illuminate/Pagination/Presenter.php | 4 +- src/Illuminate/Pagination/views/simple.php | 2 +- src/Illuminate/Pagination/views/slider-3.php | 2 +- src/Illuminate/Pagination/views/slider.php | 2 +- .../PaginationBootstrapPresenterTest.php | 4 +- tests/Pagination/PaginationPaginatorTest.php | 48 +++++++++---------- 9 files changed, 40 insertions(+), 40 deletions(-) diff --git a/ci/convergence-baseline.txt b/ci/convergence-baseline.txt index b66004290..c88a7b26b 100644 --- a/ci/convergence-baseline.txt +++ b/ci/convergence-baseline.txt @@ -8,5 +8,5 @@ eloquent_lists=6 macroable_trait=12 softdeleting_trait=2 legacy_contracts=37 -pagination_getters=15 +pagination_getters=10 route_filters=4 diff --git a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php index 158f6240b..1b66d6ba0 100755 --- a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php @@ -184,7 +184,7 @@ public function paginate($perPage = null, $columns = array('*')) // from the database since this isn't performed by the Eloquent builder. $pager = $this->query->paginate($perPage, $columns); - $this->hydratePivotRelation($pager->getItems()); + $this->hydratePivotRelation($pager->items()); return $pager; } diff --git a/src/Illuminate/Pagination/Paginator.php b/src/Illuminate/Pagination/Paginator.php index 86438962a..121ef27ef 100755 --- a/src/Illuminate/Pagination/Paginator.php +++ b/src/Illuminate/Pagination/Paginator.php @@ -318,7 +318,7 @@ public function isQuickPaginating() * @param int|null $total * @return int */ - public function getCurrentPage($total = null) + public function currentPage($total = null) { if (is_null($total)) { @@ -333,7 +333,7 @@ public function getCurrentPage($total = null) * * @return int */ - public function getLastPage() + public function lastPage() { return $this->lastPage; } @@ -343,7 +343,7 @@ public function getLastPage() * * @return int */ - public function getFrom() + public function firstItem() { return $this->from; } @@ -353,7 +353,7 @@ public function getFrom() * * @return int */ - public function getTo() + public function lastItem() { return $this->to; } @@ -363,7 +363,7 @@ public function getTo() * * @return int */ - public function getPerPage() + public function perPage() { return $this->perPage; } @@ -383,7 +383,7 @@ public function getCollection() * * @return array */ - public function getItems() + public function items() { return $this->items; } @@ -404,7 +404,7 @@ public function setItems($items) * * @return int */ - public function getTotal() + public function total() { return $this->total; } diff --git a/src/Illuminate/Pagination/Presenter.php b/src/Illuminate/Pagination/Presenter.php index ea77be866..42a9eb789 100755 --- a/src/Illuminate/Pagination/Presenter.php +++ b/src/Illuminate/Pagination/Presenter.php @@ -32,8 +32,8 @@ abstract class Presenter { public function __construct(Paginator $paginator) { $this->paginator = $paginator; - $this->lastPage = $this->paginator->getLastPage(); - $this->currentPage = $this->paginator->getCurrentPage(); + $this->lastPage = $this->paginator->lastPage(); + $this->currentPage = $this->paginator->currentPage(); } /** diff --git a/src/Illuminate/Pagination/views/simple.php b/src/Illuminate/Pagination/views/simple.php index 3a134823c..36353c327 100755 --- a/src/Illuminate/Pagination/views/simple.php +++ b/src/Illuminate/Pagination/views/simple.php @@ -4,7 +4,7 @@ $trans = $environment->getTranslator(); ?> -getLastPage() > 1): ?> +lastPage() > 1): ?>