Skip to content

Commit

Permalink
Merge pull request #97 from marcreichel/upgrade
Browse files Browse the repository at this point in the history
⬆️ Upgrade Dependencies
  • Loading branch information
marcreichel authored Jan 24, 2025
2 parents 46c385e + c20297f commit 551bce0
Show file tree
Hide file tree
Showing 76 changed files with 235 additions and 408 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2]
php: [8.4]
laravel: ['10.*', '11.*']
stability: [prefer-lowest]
include:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.3, 8.2, 8.1]
laravel: ['10.*', '11.*']
php: [8.4, 8.3, 8.2]
laravel: ['11.*']
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/type-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.4
coverage: xdebug
- name: Install dependencies
run: composer install --prefer-dist --no-progress --dev
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
"type": "library",
"minimum-stability": "stable",
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"illuminate/support": "^9.0|^10.0|^11.0",
"illuminate/support": "^11.0",
"guzzlehttp/guzzle": "~6.0|~7.0",
"nesbot/carbon": "^2.53.1|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.4 || ^10.0.0",
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0",
"nunomaduro/collision": "^5.3|^6.1|^7.0|^8.0",
"orchestra/testbench": "^9.0",
"nunomaduro/collision": "^8.0",
"roave/security-advisories": "dev-latest",
"larastan/larastan": "^2.9.2",
"larastan/larastan": "^3.0.2",
"laravel/pint": "^1.13",
"pestphp/pest": "^2",
"pestphp/pest-plugin-type-coverage": "^2.8.3"
"pestphp/pest": "^3.7.4",
"pestphp/pest-plugin-type-coverage": "^3.2.3",
"rector/rector": "^2.0.7"
},
"license": "MIT",
"authors": [
Expand Down
36 changes: 36 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withPhpSets(php84: true)
->withAttributesSets(phpunit: true)
->withRules([
Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector::class,
Rector\CodeQuality\Rector\NullsafeMethodCall\CleanupUnneededNullsafeOperatorRector::class,
Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector::class,
Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector::class,
Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector::class,
Rector\Php80\Rector\Class_\StringableForToStringRector::class,
Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector::class,
Rector\CodingStyle\Rector\Closure\StaticClosureRector::class,
Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class,
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector::class,
Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector::class,
Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class,
Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector::class,
Rector\CodeQuality\Rector\BooleanAnd\RemoveUselessIsObjectCheckRector::class,
])
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withTypeCoverageLevel(0);
12 changes: 6 additions & 6 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function orderByDesc(string $key): self
*/
public function with(array $relationships): self
{
$relationships = collect($relationships)->mapWithKeys(function (
$relationships = collect($relationships)->mapWithKeys(static function (
mixed $fields,
mixed $relationship,
) {
Expand All @@ -133,12 +133,12 @@ public function with(array $relationships): self
}

return [$relationship => $fields];
})->map(function (mixed $fields, mixed $relationship) {
})->map(static function (mixed $fields, mixed $relationship) {
if (collect($fields)->count() === 0) {
$fields = ['*'];
}

return collect($fields)->map(fn (mixed $field) => $relationship . '.' . $field)->implode(',');
return collect($fields)->map(static fn (mixed $field) => $relationship . '.' . $field)->implode(',');
})
->values()
->toArray();
Expand Down Expand Up @@ -167,16 +167,16 @@ public function cache(int $seconds): self
*/
public function getQuery(): string
{
return $this->query->map(function (mixed $value, string $key) {
return $this->query->map(static function (mixed $value, string $key) {
if ($key === 'where') {
return collect($value)->unique()->implode(' ');
}
if ($key === 'fields') {
return collect($value)->unique()->sortBy(fn (mixed $field) => count(explode('.', $field)))->implode(',');
return collect($value)->unique()->sortBy(static fn (mixed $field) => count(explode('.', $field)))->implode(',');
}

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

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Console/CreateWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function handle(): int
$fullQualifiedName = $namespace . $closestModel;
}

/** @var Model $class */
/** @var class-string<Model> $class */
$class = $fullQualifiedName;

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

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

private function getClosestModel(string $model): ?string
{
return collect($this->getModels())->map(fn (string $m): array => [
return collect($this->getModels())->map(static fn (string $m): array => [
'model' => $m,
'levenshtein' => levenshtein($m, $model),
])
->filter(fn (array $m) => $m['levenshtein'] <= 5)
->sortBy(fn (array $m) => $m['levenshtein'])
->map(fn (array $m) => $m['model'])
->filter(static fn (array $m) => $m['levenshtein'] <= 5)
->sortBy(static fn (array $m) => $m['levenshtein'])
->map(static fn (array $m) => $m['model'])
->first();
}
}
6 changes: 3 additions & 3 deletions src/Console/DeleteWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function handle(): int
{
$id = (int) $this->argument('id');

if ($id) {
if ($id !== 0) {
return $this->deleteOne($id);
}

Expand Down Expand Up @@ -59,15 +59,15 @@ private function deleteAll(): int
{
$webhooks = Webhook::all();

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

return self::SUCCESS;
}

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

$this->withProgressBar($webhooks, function (Webhook $webhook): void {
$this->withProgressBar($webhooks, static function (Webhook $webhook): void {
$webhook->delete();
});

Expand Down
4 changes: 2 additions & 2 deletions src/Console/ListWebhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public function handle(): int
{
$webhooks = Webhook::all();

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

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

$data['active'] = $data['active'] ? '' : '';
Expand Down
2 changes: 1 addition & 1 deletion src/Console/ReactivateWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle(): int
return self::FAILURE;
}

/** @var Model $class */
/** @var class-string<Model> $class */
$class = $fullQualifiedName;

try {
Expand Down
5 changes: 1 addition & 4 deletions src/Events/AgeRatingContentDescriptionCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class AgeRatingContentDescriptionCreated extends Event
{
public AgeRatingContentDescription $data;

public function __construct(AgeRatingContentDescription $data, Request $request)
public function __construct(public AgeRatingContentDescription $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/AgeRatingCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class AgeRatingCreated extends Event
{
public AgeRating $data;

public function __construct(AgeRating $data, Request $request)
public function __construct(public AgeRating $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/AlternativeNameCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class AlternativeNameCreated extends Event
{
public AlternativeName $data;

public function __construct(AlternativeName $data, Request $request)
public function __construct(public AlternativeName $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/ArtworkCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class ArtworkCreated extends Event
{
public Artwork $data;

public function __construct(Artwork $data, Request $request)
public function __construct(public Artwork $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/CharacterCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class CharacterCreated extends Event
{
public Character $data;

public function __construct(Character $data, Request $request)
public function __construct(public Character $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/CharacterMugShotCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class CharacterMugShotCreated extends Event
{
public CharacterMugShot $data;

public function __construct(CharacterMugShot $data, Request $request)
public function __construct(public CharacterMugShot $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/CollectionCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class CollectionCreated extends Event
{
public Collection $data;

public function __construct(Collection $data, Request $request)
public function __construct(public Collection $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/CollectionMembershipCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class CollectionMembershipCreated extends Event
{
public CollectionMembership $data;

public function __construct(CollectionMembership $data, Request $request)
public function __construct(public CollectionMembership $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/CollectionMembershipTypeCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class CollectionMembershipTypeCreated extends Event
{
public CollectionMembershipType $data;

public function __construct(CollectionMembershipType $data, Request $request)
public function __construct(public CollectionMembershipType $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
6 changes: 1 addition & 5 deletions src/Events/CollectionRelationCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@

class CollectionRelationCreated extends Event
{
public CollectionRelation $data;

public function __construct(CollectionRelation $data, Request $request)
public function __construct(public CollectionRelation $data, Request $request)
{
parent::__construct($request);

$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/CollectionRelationTypeCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class CollectionRelationTypeCreated extends Event
{
public CollectionRelationType $data;

public function __construct(CollectionRelationType $data, Request $request)
public function __construct(public CollectionRelationType $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
5 changes: 1 addition & 4 deletions src/Events/CollectionTypeCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class CollectionTypeCreated extends Event
{
public CollectionType $data;

public function __construct(CollectionType $data, Request $request)
public function __construct(public CollectionType $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
Loading

0 comments on commit 551bce0

Please sign in to comment.