Skip to content

Commit fe9c806

Browse files
committed
Update PHP version to 8.4 and enhance configuration for Laravel 12 support
Signed-off-by: Lloric Mayuga Garcia <[email protected]>
1 parent badef08 commit fe9c806

File tree

12 files changed

+47
-45
lines changed

12 files changed

+47
-45
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.3'
19+
php-version: '8.4'
2020
coverage: none
2121

2222
- name: Install composer dependencies

.github/workflows/run-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest]
16-
php: [8.3, 8.2, 8.1]
16+
php: [8.4, 8.3, 8.2, 8.1]
1717
laravel: [^10.0, ^11.0]
1818
stability: [prefer-lowest, prefer-stable]
1919
include:
2020
- laravel: ^10.0
2121
testbench: ^8.0
2222
- laravel: ^11.0
2323
testbench: ^9.0
24+
- laravel: ^12.0
25+
testbench: ^10.0
2426
exclude:
2527
- laravel: ^11.0
2628
php: 8.1

composer.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@
1313
],
1414
"require": {
1515
"php": "^8.1",
16-
"illuminate/contracts": "^10.0|^11.0",
16+
"illuminate/contracts": "^10.0|^11.0|^12.0",
1717
"spatie/laravel-package-tools": "^1.16.2"
1818
},
1919
"require-dev": {
20-
"composer-runtime-api": "^2.2",
21-
"orchestra/testbench": "^8.0|^9.0",
22-
"pestphp/pest" : "^2.34.1",
23-
"rector/rector": "^1.0.2",
24-
"spatie/pest-plugin-snapshots": "^2.1.0",
20+
"larastan/larastan": "^3.1.0",
2521
"laravel/pint": "^1.14",
26-
"phpstan/phpstan": "^1.10.59",
27-
"larastan/larastan": "^2.9.2"
22+
"orchestra/testbench": "^8.0|^9.0|^10.0",
23+
"pestphp/pest": "^3.7.4",
24+
"phpstan/extension-installer": "^1.4",
25+
"phpstan/phpstan": "^2.1.6",
26+
"rector/rector": "^2.0.9",
27+
"spatie/pest-plugin-snapshots": "^2.1.0",
28+
"ticketswap/phpstan-error-formatter": "^1.1"
2829
},
2930
"autoload": {
3031
"psr-4": {
@@ -55,8 +56,10 @@
5556
"refactor-dry-run": "vendor/bin/rector process --dry-run"
5657
},
5758
"config": {
59+
"sort-packages": true,
5860
"allow-plugins": {
59-
"pestphp/pest-plugin": true
61+
"pestphp/pest-plugin": true,
62+
"phpstan/extension-installer": true
6063
}
6164
},
6265
"minimum-stability": "dev",

phpstan.neon

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
includes:
2-
- ./vendor/larastan/larastan/extension.neon
2+
33
parameters:
44
level: 8
55
paths:
66
- src
77

8+
tmpDir: build/phpstan
9+
810
ignoreErrors:
11+
- identifier: missingType.iterableValue
12+
13+
errorFormat: ticketswap
14+
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
915

10-
tmpDir: build/phpstan
11-
checkMissingIterableValueType: false
12-
# larastan
13-
checkGenericClassInNonGenericObjectType: false

pint.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
],
1010
"rules": {
1111
"declare_strict_types": true,
12-
"single_trait_insert_per_statement": true
12+
"single_trait_insert_per_statement": true,
13+
"strict_comparison": true,
14+
"strict_param": true
1315
}
1416
}

rector.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22

33
declare(strict_types=1);
44

5-
use Rector\Config\RectorConfig;
6-
use Rector\Set\ValueObject\SetList;
7-
use Rector\ValueObject\PhpVersion;
8-
9-
return static function (RectorConfig $rectorConfig): void {
10-
$rectorConfig->paths([
5+
return Rector\Config\RectorConfig::configure()
6+
->withParallel(maxNumberOfProcess: 6)
7+
->withPhpSets()
8+
->withPaths([
119
__DIR__.'/src',
12-
]);
13-
14-
$rectorConfig->sets([
15-
SetList::PHP_81,
16-
]);
17-
18-
$rectorConfig->phpVersion(PhpVersion::PHP_81);
19-
20-
// $rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon.dist');
21-
};
10+
__DIR__.'/tests',
11+
])
12+
->withCache(
13+
cacheDirectory: 'build/rector',
14+
cacheClass: Rector\Caching\ValueObject\Storage\FileCacheStorage::class,
15+
);

src/Generator.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ private function rowsData(array $data): string
107107
return $output.$this->tags->body_end;
108108
}
109109

110+
/**
111+
* @param Builder<Model> $query
112+
*/
110113
private function rowsDataWithModel(Builder $query, array $fields, int $limit): string
111114
{
112115
$query
@@ -157,7 +160,7 @@ private function optionLinks(Model $model): string
157160
$link = route($this->optionLinks->routeName, $model->getRouteKey());
158161
}
159162

160-
$label = $this->optionLinks?->rowLabel ?? trans('View');
163+
$label = $this->optionLinks->rowLabel ?? trans('View');
161164

162165
return "<a href=\"$link\">$label</a>";
163166
}
@@ -245,7 +248,7 @@ protected function applyCustomTags(string|array|TableTags $customTags): void
245248

246249
private function reset(): void
247250
{
248-
$this->tags = new TableTags();
251+
$this->tags = new TableTags;
249252
$this->optionLinks = null;
250253
}
251254
}

src/ModelOptionLinks.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ public function __construct(
1010
public readonly string $routeName,
1111
public readonly string $headerLabel = 'Options',
1212
public readonly ?string $rowLabel = null,
13-
) {
14-
}
13+
) {}
1514
}

src/Providers/LaravelHtmlTableProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function packageRegistered(): void
2020
{
2121
$this->app->singleton(
2222
'lloricodelaravelhtmltable',
23-
fn ($app) => new LaravelHtmlTableGenerator()
23+
fn ($app) => new LaravelHtmlTableGenerator
2424
);
2525
}
2626
}

src/TableTags.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public function __construct(
3434
public readonly string $alt_body_row_end = '</tr>',
3535
public readonly string $alt_body_cell = '<td>',
3636
public readonly string $alt_body_cell_end = '</td>',
37-
) {
38-
}
37+
) {}
3938

4039
public function getBodyRow(bool $alt = false): string
4140
{

0 commit comments

Comments
 (0)