Skip to content

Commit 551bce0

Browse files
authored
Merge pull request #97 from marcreichel/upgrade
⬆️ Upgrade Dependencies
2 parents 46c385e + c20297f commit 551bce0

File tree

76 files changed

+235
-408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+235
-408
lines changed

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: true
1313
matrix:
1414
os: [ubuntu-latest]
15-
php: [8.2]
15+
php: [8.4]
1616
laravel: ['10.*', '11.*']
1717
stability: [prefer-lowest]
1818
include:

.github/workflows/tests.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,12 @@ jobs:
1313
strategy:
1414
fail-fast: true
1515
matrix:
16-
php: [8.3, 8.2, 8.1]
17-
laravel: ['10.*', '11.*']
16+
php: [8.4, 8.3, 8.2]
17+
laravel: ['11.*']
1818
stability: [prefer-stable]
1919
include:
20-
- laravel: 10.*
21-
testbench: 8.*
2220
- laravel: 11.*
2321
testbench: 9.*
24-
exclude:
25-
- laravel: 11.*
26-
php: 8.1
2722

2823
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }}
2924

.github/workflows/type-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup PHP
1515
uses: shivammathur/setup-php@v2
1616
with:
17-
php-version: 8.2
17+
php-version: 8.4
1818
coverage: xdebug
1919
- name: Install dependencies
2020
run: composer install --prefer-dist --no-progress --dev

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
"type": "library",
1313
"minimum-stability": "stable",
1414
"require": {
15-
"php": "^8.1",
15+
"php": "^8.2",
1616
"ext-json": "*",
17-
"illuminate/support": "^9.0|^10.0|^11.0",
17+
"illuminate/support": "^11.0",
1818
"guzzlehttp/guzzle": "~6.0|~7.0",
1919
"nesbot/carbon": "^2.53.1|^3.0"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^9.5.4 || ^10.0.0",
23-
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0",
24-
"nunomaduro/collision": "^5.3|^6.1|^7.0|^8.0",
22+
"orchestra/testbench": "^9.0",
23+
"nunomaduro/collision": "^8.0",
2524
"roave/security-advisories": "dev-latest",
26-
"larastan/larastan": "^2.9.2",
25+
"larastan/larastan": "^3.0.2",
2726
"laravel/pint": "^1.13",
28-
"pestphp/pest": "^2",
29-
"pestphp/pest-plugin-type-coverage": "^2.8.3"
27+
"pestphp/pest": "^3.7.4",
28+
"pestphp/pest-plugin-type-coverage": "^3.2.3",
29+
"rector/rector": "^2.0.7"
3030
},
3131
"license": "MIT",
3232
"authors": [

rector.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
7+
return RectorConfig::configure()
8+
->withPhpSets(php84: true)
9+
->withAttributesSets(phpunit: true)
10+
->withRules([
11+
Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector::class,
12+
Rector\CodeQuality\Rector\NullsafeMethodCall\CleanupUnneededNullsafeOperatorRector::class,
13+
Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector::class,
14+
Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector::class,
15+
Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector::class,
16+
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector::class,
17+
Rector\Php80\Rector\Class_\StringableForToStringRector::class,
18+
Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector::class,
19+
Rector\CodingStyle\Rector\Closure\StaticClosureRector::class,
20+
Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class,
21+
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector::class,
22+
Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector::class,
23+
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector::class,
24+
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::class,
25+
Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector::class,
26+
Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector::class,
27+
Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector::class,
28+
Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class,
29+
Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector::class,
30+
Rector\CodeQuality\Rector\BooleanAnd\RemoveUselessIsObjectCheckRector::class,
31+
])
32+
->withPaths([
33+
__DIR__ . '/src',
34+
__DIR__ . '/tests',
35+
])
36+
->withTypeCoverageLevel(0);

src/Builder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function orderByDesc(string $key): self
124124
*/
125125
public function with(array $relationships): self
126126
{
127-
$relationships = collect($relationships)->mapWithKeys(function (
127+
$relationships = collect($relationships)->mapWithKeys(static function (
128128
mixed $fields,
129129
mixed $relationship,
130130
) {
@@ -133,12 +133,12 @@ public function with(array $relationships): self
133133
}
134134

135135
return [$relationship => $fields];
136-
})->map(function (mixed $fields, mixed $relationship) {
136+
})->map(static function (mixed $fields, mixed $relationship) {
137137
if (collect($fields)->count() === 0) {
138138
$fields = ['*'];
139139
}
140140

141-
return collect($fields)->map(fn (mixed $field) => $relationship . '.' . $field)->implode(',');
141+
return collect($fields)->map(static fn (mixed $field) => $relationship . '.' . $field)->implode(',');
142142
})
143143
->values()
144144
->toArray();
@@ -167,16 +167,16 @@ public function cache(int $seconds): self
167167
*/
168168
public function getQuery(): string
169169
{
170-
return $this->query->map(function (mixed $value, string $key) {
170+
return $this->query->map(static function (mixed $value, string $key) {
171171
if ($key === 'where') {
172172
return collect($value)->unique()->implode(' ');
173173
}
174174
if ($key === 'fields') {
175-
return collect($value)->unique()->sortBy(fn (mixed $field) => count(explode('.', $field)))->implode(',');
175+
return collect($value)->unique()->sortBy(static fn (mixed $field) => count(explode('.', $field)))->implode(',');
176176
}
177177

178178
return $value;
179-
})->map(fn (mixed $value, string $key) => Str::finish($key . ' ' . $value, ';'))->unique()->sort()->implode("\n");
179+
})->map(static fn (mixed $value, string $key) => Str::finish($key . ' ' . $value, ';'))->unique()->sort()->implode("\n");
180180
}
181181

182182
/**

src/Console/CreateWebhook.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle(): int
5151
$fullQualifiedName = $namespace . $closestModel;
5252
}
5353

54-
/** @var Model $class */
54+
/** @var class-string<Model> $class */
5555
$class = $fullQualifiedName;
5656

5757
$methods = ['create', 'update', 'delete'];
@@ -95,19 +95,19 @@ private function getModels(): array
9595
$grep = preg_grep($pattern, $glob, PREG_GREP_INVERT);
9696

9797
return collect($grep ?: [])
98-
->map(fn (string $path): string => basename($path, '.php'))
98+
->map(static fn (string $path): string => basename($path, '.php'))
9999
->toArray();
100100
}
101101

102102
private function getClosestModel(string $model): ?string
103103
{
104-
return collect($this->getModels())->map(fn (string $m): array => [
104+
return collect($this->getModels())->map(static fn (string $m): array => [
105105
'model' => $m,
106106
'levenshtein' => levenshtein($m, $model),
107107
])
108-
->filter(fn (array $m) => $m['levenshtein'] <= 5)
109-
->sortBy(fn (array $m) => $m['levenshtein'])
110-
->map(fn (array $m) => $m['model'])
108+
->filter(static fn (array $m) => $m['levenshtein'] <= 5)
109+
->sortBy(static fn (array $m) => $m['levenshtein'])
110+
->map(static fn (array $m) => $m['model'])
111111
->first();
112112
}
113113
}

src/Console/DeleteWebhook.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function handle(): int
2323
{
2424
$id = (int) $this->argument('id');
2525

26-
if ($id) {
26+
if ($id !== 0) {
2727
return $this->deleteOne($id);
2828
}
2929

@@ -59,15 +59,15 @@ private function deleteAll(): int
5959
{
6060
$webhooks = Webhook::all();
6161

62-
if (!$webhooks->count()) {
62+
if ($webhooks->count() === 0) {
6363
$this->info('You do not have any registered webhooks.');
6464

6565
return self::SUCCESS;
6666
}
6767

6868
$this->comment('Deleting all your registered webhooks ...');
6969

70-
$this->withProgressBar($webhooks, function (Webhook $webhook): void {
70+
$this->withProgressBar($webhooks, static function (Webhook $webhook): void {
7171
$webhook->delete();
7272
});
7373

src/Console/ListWebhooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ public function handle(): int
1717
{
1818
$webhooks = Webhook::all();
1919

20-
if (!$webhooks->count()) {
20+
if ($webhooks->count() === 0) {
2121
$this->warn('You do not have any registered webhooks.');
2222

2323
return self::FAILURE;
2424
}
2525
$this->table(
2626
['ID', 'URL', 'Model', 'Method', 'Retries', 'Active'],
27-
$webhooks->map(function (Webhook $webhook) {
27+
$webhooks->map(static function (Webhook $webhook) {
2828
$data = $webhook->toArray();
2929

3030
$data['active'] = $data['active'] ? '' : '';

src/Console/ReactivateWebhook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function handle(): int
5050
return self::FAILURE;
5151
}
5252

53-
/** @var Model $class */
53+
/** @var class-string<Model> $class */
5454
$class = $fullQualifiedName;
5555

5656
try {

0 commit comments

Comments
 (0)