Skip to content

Commit 76396e9

Browse files
authored
Merge pull request #36 from defstudio/php8.4
php 8.4 support
2 parents 63afc7e + adbc4c7 commit 76396e9

File tree

12 files changed

+21
-21
lines changed

12 files changed

+21
-21
lines changed

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.1'
19+
php-version: [8.3, 8.4]
2020
coverage: none
2121

2222
- name: Install composer dependencies

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
php: [8.1]
16+
php: [8.3, 8.4]
1717
laravel: [9.*]
1818
stability: [prefer-lowest, prefer-stable]
1919

.github/workflows/x-ray.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.1'
19+
php-version: [8.3, 8.4]
2020
coverage: none
2121

2222
- name: Install composer dependencies

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^8.1",
19+
"php": "^8.3|8.4",
2020
"spatie/laravel-package-tools": "^1.9.2",
2121
"illuminate/contracts": "^9.0|^10.0",
2222
"illuminate/database": "^9.0|^10.0",
@@ -50,8 +50,8 @@
5050
},
5151
"scripts": {
5252
"x-ray": "vendor/bin/x-ray .",
53-
"lint": "vendor/bin/php-cs-fixer fix -v",
54-
"test:lint": "vendor/bin/php-cs-fixer fix -v --dry-run",
53+
"lint": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix -v",
54+
"test:lint": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix -v --dry-run",
5555
"test:types": "vendor/bin/phpstan analyse --ansi",
5656
"test:unit": "vendor/bin/pest --colors=always --exclude-group=sandbox",
5757
"test": [

src/Concerns/BuildsQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getRowsProperty(): Collection|LengthAwarePaginator
6565
return $this->paginatedResults();
6666
}
6767

68-
public function debugQuery(Builder|Relation $query = null): string
68+
public function debugQuery(Builder|Relation|null $query = null): string
6969
{
7070
$paginationEnabled = $query === null && $this->paginationEnabled();
7171

@@ -79,7 +79,7 @@ public function debugQuery(Builder|Relation $query = null): string
7979
->replaceArray('?', collect($query->getBindings())->map(function ($binding) {
8080
return is_numeric($binding) ? $binding : "'{$binding}'";
8181
})->toArray())
82-
->when($paginationEnabled, fn (Stringable $str) => $str->append(' limit ', $this->pageSize, ' offset ', $this->pageSize * ($this->rows->currentPage() - 1)));
82+
->when($paginationEnabled, fn (Stringable $str) => $str->append(' limit ', $this->pageSize, ' offset ', intval($this->pageSize) * ($this->rows->currentPage() - 1)));
8383
}
8484

8585
public function selectedRows(): Builder|Relation

src/Concerns/HasActions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getActionsProperty(): array
4040
return $this->_actions;
4141
}
4242

43-
public function action(string $name, string $method = null): Action
43+
public function action(string $name, ?string $method = null): Action
4444
{
4545
if ($this->_actionsLocked) {
4646
throw ActionException::locked();

src/Concerns/HasColumns.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getColumnsProperty(): array
4040
return $this->_columns;
4141
}
4242

43-
protected function column(string $name, string $dbColumn = null): Column
43+
protected function column(string $name, ?string $dbColumn = null): Column
4444
{
4545
if ($this->_columnsLocked) {
4646
throw ColumnException::locked();

src/Concerns/HasFilters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getFiltersProperty(): array
6060
return $this->_filters;
6161
}
6262

63-
public function filter(string $name, string $key = null): Filter
63+
public function filter(string $name, ?string $key = null): Filter
6464
{
6565
if ($this->_filtersLocked) {
6666
throw FilterException::locked();
@@ -153,7 +153,7 @@ public function applyFilters(Builder|Relation $query): void
153153
->each(fn (Filter $filter) => $filter->apply($query));
154154
}
155155

156-
public function getFilterValue(string $key, string|int|bool $default = null): string|int|bool|null
156+
public function getFilterValue(string $key, string|int|bool|null $default = null): string|int|bool|null
157157
{
158158
if (!$this->_filtersLocked && request()->input('updates.0.payload.name') === "filterValues.$key") {
159159
return request()->input('updates.0.payload.value', 0);

src/Concerns/HasSorting.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function sort(string $columnName): void
6969
$this->storeState('sorting', $this->sorting);
7070
}
7171

72-
public function clearSorting(string $columnName = null): bool
72+
public function clearSorting(?string $columnName = null): bool
7373
{
7474
if ($columnName) {
7575
unset($this->sorting[$columnName]);

src/Elements/Column.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function initDefaults(): void
4545
$this->set(Config::is_searchable, false);
4646
}
4747

48-
protected function runClosure(Closure $formatClosure): mixed
48+
public function runClosure(Closure $formatClosure): mixed
4949
{
5050
$reflection = new \ReflectionFunction($formatClosure);
5151

@@ -116,7 +116,7 @@ public function wrapText(bool $enable = true): static
116116
/**
117117
* @param null|Closure(Builder $query, Sorting $dir): void $sortClosure
118118
*/
119-
public function sortable(Closure $sortClosure = null): static
119+
public function sortable(?Closure $sortClosure = null): static
120120
{
121121
return $this->set(Config::is_sortable, true)
122122
->set(Config::sort_closure, $sortClosure);
@@ -135,7 +135,7 @@ public function hasSortClosure(): bool
135135
/**
136136
* @param (Closure(mixed $value, Model $model, Column $column): (string|null))|(Closure(Model $model, Column $column): (string|null)) $urlClosure
137137
*/
138-
public function url(Closure $urlClosure, string $target = null): static
138+
public function url(Closure $urlClosure, ?string $target = null): static
139139
{
140140
return $this->set(Config::url, $urlClosure)
141141
->set(Config::url_target, $target);
@@ -144,7 +144,7 @@ public function url(Closure $urlClosure, string $target = null): static
144144
/**
145145
* @param (Closure(mixed $value, Model $model, Column $column): (string|array|null))|(Closure(Model $model, Column $column): (string|array|null)) $emitClosure
146146
*/
147-
public function emit(Closure $emitClosure, string $target = null): static
147+
public function emit(Closure $emitClosure, ?string $target = null): static
148148
{
149149
return $this->set(Config::emit, $emitClosure);
150150
}
@@ -175,7 +175,7 @@ public function applySortClosure(Builder|Relation $query, Sorting $dir): void
175175
$this->get(Config::sort_closure)($query, $dir);
176176
}
177177

178-
public function searchable(callable $searchClosure = null): static
178+
public function searchable(?callable $searchClosure = null): static
179179
{
180180
return $this->set(Config::is_searchable, true)
181181
->set(Config::search_closure, $searchClosure);
@@ -206,7 +206,7 @@ public function format(Closure $formatClosure): static
206206
return $this->set(Config::format_closure, $formatClosure);
207207
}
208208

209-
public function date(string $format = null): static
209+
public function date(?string $format = null): static
210210
{
211211
return $this->format(function ($value) use ($format) {
212212
if (empty($value)) {

0 commit comments

Comments
 (0)