Skip to content

Commit

Permalink
fix: php 8.4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdw committed Dec 11, 2024
1 parent fbf38d4 commit a8f29e2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ collect($posts)->paginate(5);
This paginates the contents of `$posts` with 5 items per page. `paginate` accepts quite some options, head over to [the Laravel docs](https://laravel.com/docs/5.4/pagination) for an in-depth guide.

```
paginate(int $perPage = 15, string $pageName = 'page', int $page = null, int $total = null, array $options = [])
paginate(int $perPage = 15, string $pageName = 'page', ?int $page = null, ?int $total = null, array $options = [])
```

### `path`
Expand Down Expand Up @@ -806,7 +806,7 @@ collect($posts)->simplePaginate(5);
This paginates the contents of `$posts` with 5 items per page. `simplePaginate` accepts quite some options, head over to [the Laravel docs](https://laravel.com/docs/5.4/pagination) for an in-depth guide.

```
simplePaginate(int $perPage = 15, string $pageName = 'page', int $page = null, int $total = null, array $options = [])
simplePaginate(int $perPage = 15, string $pageName = 'page', ?int $page = null, ?int $total = null, array $options = [])
```

For a in-depth guide on pagination, check out [the Laravel docs](https://laravel.com/docs/5.4/pagination).
Expand Down
2 changes: 1 addition & 1 deletion src/Macros/Paginate.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Paginate
{
public function __invoke()
{
return function (int $perPage = 15, string $pageName = 'page', int $page = null, int $total = null, array $options = []): LengthAwarePaginator {
return function (int $perPage = 15, string $pageName = 'page', ?int $page = null, ?int $total = null, array $options = []): LengthAwarePaginator {
$page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);

$results = $this->forPage($page, $perPage)->values();
Expand Down
2 changes: 1 addition & 1 deletion src/Macros/SimplePaginate.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SimplePaginate
{
public function __invoke()
{
return function (int $perPage = 15, string $pageName = 'page', int $page = null, array $options = []): Paginator {
return function (int $perPage = 15, string $pageName = 'page', ?int $page = null, array $options = []): Paginator {
$page = $page ?: Paginator::resolveCurrentPage($pageName);

$results = $this->slice(($page - 1) * $perPage)->take($perPage + 1);
Expand Down

0 comments on commit a8f29e2

Please sign in to comment.