From 5b19e07138145bbc5c0d86a8417bb1590f4f96a0 Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Fri, 24 Jan 2025 19:34:21 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20Dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codecov.yml | 2 +- .github/workflows/tests.yml | 2 +- .github/workflows/type-coverage.yml | 2 +- composer.json | 8 +- rector.php | 36 ++++ src/Builder.php | 12 +- src/Console/CreateWebhook.php | 10 +- src/Console/DeleteWebhook.php | 6 +- src/Console/ListWebhooks.php | 4 +- .../AgeRatingContentDescriptionCreated.php | 5 +- src/Events/AgeRatingCreated.php | 5 +- src/Events/AlternativeNameCreated.php | 5 +- src/Events/ArtworkCreated.php | 5 +- src/Events/CharacterCreated.php | 5 +- src/Events/CharacterMugShotCreated.php | 5 +- src/Events/CollectionCreated.php | 5 +- src/Events/CollectionMembershipCreated.php | 5 +- .../CollectionMembershipTypeCreated.php | 5 +- src/Events/CollectionRelationCreated.php | 6 +- src/Events/CollectionRelationTypeCreated.php | 5 +- src/Events/CollectionTypeCreated.php | 5 +- src/Events/CompanyCreated.php | 5 +- src/Events/CompanyLogoCreated.php | 5 +- src/Events/CompanyWebsiteCreated.php | 5 +- src/Events/CoverCreated.php | 5 +- src/Events/EventCreated.php | 5 +- src/Events/EventLogoCreated.php | 5 +- src/Events/EventNetworkCreated.php | 5 +- src/Events/ExternalGameCreated.php | 5 +- src/Events/FranchiseCreated.php | 5 +- src/Events/GameCreated.php | 5 +- src/Events/GameEngineCreated.php | 5 +- src/Events/GameEngineLogoCreated.php | 5 +- src/Events/GameLocalizationCreated.php | 5 +- src/Events/GameModeCreated.php | 5 +- src/Events/GameVersionCreated.php | 5 +- src/Events/GameVersionFeatureCreated.php | 5 +- src/Events/GameVersionFeatureValueCreated.php | 5 +- src/Events/GameVideoCreated.php | 5 +- src/Events/GenreCreated.php | 5 +- src/Events/InvolvedCompanyCreated.php | 5 +- src/Events/KeywordCreated.php | 5 +- src/Events/LanguageCreated.php | 5 +- src/Events/LanguageSupportCreated.php | 5 +- src/Events/LanguageSupportTypeCreated.php | 5 +- src/Events/MultiplayerModeCreated.php | 5 +- src/Events/NetworkTypeCreated.php | 5 +- src/Events/PlatformCreated.php | 5 +- src/Events/PlatformFamilyCreated.php | 5 +- src/Events/PlatformLogoCreated.php | 5 +- src/Events/PlatformVersionCompanyCreated.php | 5 +- src/Events/PlatformVersionCreated.php | 5 +- .../PlatformVersionReleaseDateCreated.php | 5 +- src/Events/PlatformWebsiteCreated.php | 5 +- src/Events/PlayerPerspectiveCreated.php | 5 +- src/Events/PopularityTypeCreated.php | 5 +- src/Events/RegionCreated.php | 5 +- src/Events/ReleaseDateCreated.php | 5 +- src/Events/ReleaseDateStatusCreated.php | 5 +- src/Events/ScreenshotCreated.php | 5 +- src/Events/ThemeCreated.php | 5 +- src/Events/WebsiteCreated.php | 5 +- src/Models/Model.php | 8 +- src/Models/Webhook.php | 8 +- src/Traits/HasSearch.php | 2 +- src/Traits/HasSelect.php | 2 +- src/Traits/HasWhere.php | 2 +- src/Traits/HasWhereBetween.php | 4 +- src/Traits/HasWhereIn.php | 2 +- tests/BuilderTest.php | 189 ++++++++---------- tests/EventsTest.php | 14 +- tests/ImageTest.php | 9 +- tests/ModelTest.php | 7 +- tests/TestCase.php | 4 +- tests/WebhookTest.php | 21 +- 75 files changed, 227 insertions(+), 393 deletions(-) create mode 100644 rector.php diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 8ed9c46..3782c58 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -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: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 21d65d8..4a7b777 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.3, 8.2, 8.1] + php: [8.4, 8.3, 8.2, 8.1] laravel: ['10.*', '11.*'] stability: [prefer-stable] include: diff --git a/.github/workflows/type-coverage.yml b/.github/workflows/type-coverage.yml index f03fa81..ab17aea 100644 --- a/.github/workflows/type-coverage.yml +++ b/.github/workflows/type-coverage.yml @@ -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 diff --git a/composer.json b/composer.json index 5a67363..2b25e0d 100644 --- a/composer.json +++ b/composer.json @@ -19,14 +19,14 @@ "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", "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": [ diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..f6d8629 --- /dev/null +++ b/rector.php @@ -0,0 +1,36 @@ +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); diff --git a/src/Builder.php b/src/Builder.php index 28d203c..df19cc2 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -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, ) { @@ -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(); @@ -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"); } /** diff --git a/src/Console/CreateWebhook.php b/src/Console/CreateWebhook.php index bb306a1..ae1f0ef 100644 --- a/src/Console/CreateWebhook.php +++ b/src/Console/CreateWebhook.php @@ -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(); } } diff --git a/src/Console/DeleteWebhook.php b/src/Console/DeleteWebhook.php index 48583b3..042ad2b 100644 --- a/src/Console/DeleteWebhook.php +++ b/src/Console/DeleteWebhook.php @@ -23,7 +23,7 @@ public function handle(): int { $id = (int) $this->argument('id'); - if ($id) { + if ($id !== 0) { return $this->deleteOne($id); } @@ -59,7 +59,7 @@ 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; @@ -67,7 +67,7 @@ private function deleteAll(): int $this->comment('Deleting all your registered webhooks ...'); - $this->withProgressBar($webhooks, function (Webhook $webhook): void { + $this->withProgressBar($webhooks, static function (Webhook $webhook): void { $webhook->delete(); }); diff --git a/src/Console/ListWebhooks.php b/src/Console/ListWebhooks.php index c3a4913..1911708 100644 --- a/src/Console/ListWebhooks.php +++ b/src/Console/ListWebhooks.php @@ -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'] ? ' ✅ ' : ' ❌ '; diff --git a/src/Events/AgeRatingContentDescriptionCreated.php b/src/Events/AgeRatingContentDescriptionCreated.php index 148ef69..086f0a5 100644 --- a/src/Events/AgeRatingContentDescriptionCreated.php +++ b/src/Events/AgeRatingContentDescriptionCreated.php @@ -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; } } diff --git a/src/Events/AgeRatingCreated.php b/src/Events/AgeRatingCreated.php index ed3e67a..219db2a 100644 --- a/src/Events/AgeRatingCreated.php +++ b/src/Events/AgeRatingCreated.php @@ -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; } } diff --git a/src/Events/AlternativeNameCreated.php b/src/Events/AlternativeNameCreated.php index af7f407..8c20ff4 100644 --- a/src/Events/AlternativeNameCreated.php +++ b/src/Events/AlternativeNameCreated.php @@ -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; } } diff --git a/src/Events/ArtworkCreated.php b/src/Events/ArtworkCreated.php index e2b84c8..155fd15 100644 --- a/src/Events/ArtworkCreated.php +++ b/src/Events/ArtworkCreated.php @@ -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; } } diff --git a/src/Events/CharacterCreated.php b/src/Events/CharacterCreated.php index f40573b..59968f6 100644 --- a/src/Events/CharacterCreated.php +++ b/src/Events/CharacterCreated.php @@ -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; } } diff --git a/src/Events/CharacterMugShotCreated.php b/src/Events/CharacterMugShotCreated.php index d8cf1d2..a956488 100644 --- a/src/Events/CharacterMugShotCreated.php +++ b/src/Events/CharacterMugShotCreated.php @@ -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; } } diff --git a/src/Events/CollectionCreated.php b/src/Events/CollectionCreated.php index f0044d6..3ad7e28 100644 --- a/src/Events/CollectionCreated.php +++ b/src/Events/CollectionCreated.php @@ -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; } } diff --git a/src/Events/CollectionMembershipCreated.php b/src/Events/CollectionMembershipCreated.php index dff4a20..599708a 100644 --- a/src/Events/CollectionMembershipCreated.php +++ b/src/Events/CollectionMembershipCreated.php @@ -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; } } diff --git a/src/Events/CollectionMembershipTypeCreated.php b/src/Events/CollectionMembershipTypeCreated.php index ff80d7d..8b8ccd2 100644 --- a/src/Events/CollectionMembershipTypeCreated.php +++ b/src/Events/CollectionMembershipTypeCreated.php @@ -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; } } diff --git a/src/Events/CollectionRelationCreated.php b/src/Events/CollectionRelationCreated.php index 8d0ae39..0bf6a86 100644 --- a/src/Events/CollectionRelationCreated.php +++ b/src/Events/CollectionRelationCreated.php @@ -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; } } diff --git a/src/Events/CollectionRelationTypeCreated.php b/src/Events/CollectionRelationTypeCreated.php index 6e919d4..25b8aa3 100644 --- a/src/Events/CollectionRelationTypeCreated.php +++ b/src/Events/CollectionRelationTypeCreated.php @@ -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; } } diff --git a/src/Events/CollectionTypeCreated.php b/src/Events/CollectionTypeCreated.php index 994148b..cdd2408 100644 --- a/src/Events/CollectionTypeCreated.php +++ b/src/Events/CollectionTypeCreated.php @@ -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; } } diff --git a/src/Events/CompanyCreated.php b/src/Events/CompanyCreated.php index 84998ac..8dd036e 100644 --- a/src/Events/CompanyCreated.php +++ b/src/Events/CompanyCreated.php @@ -9,11 +9,8 @@ class CompanyCreated extends Event { - public Company $data; - - public function __construct(Company $data, Request $request) + public function __construct(public Company $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/CompanyLogoCreated.php b/src/Events/CompanyLogoCreated.php index 3042459..957e86e 100644 --- a/src/Events/CompanyLogoCreated.php +++ b/src/Events/CompanyLogoCreated.php @@ -9,11 +9,8 @@ class CompanyLogoCreated extends Event { - public CompanyLogo $data; - - public function __construct(CompanyLogo $data, Request $request) + public function __construct(public CompanyLogo $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/CompanyWebsiteCreated.php b/src/Events/CompanyWebsiteCreated.php index 12f4e4c..594bf9b 100644 --- a/src/Events/CompanyWebsiteCreated.php +++ b/src/Events/CompanyWebsiteCreated.php @@ -9,11 +9,8 @@ class CompanyWebsiteCreated extends Event { - public CompanyWebsite $data; - - public function __construct(CompanyWebsite $data, Request $request) + public function __construct(public CompanyWebsite $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/CoverCreated.php b/src/Events/CoverCreated.php index 98ea2ba..09558a9 100644 --- a/src/Events/CoverCreated.php +++ b/src/Events/CoverCreated.php @@ -9,11 +9,8 @@ class CoverCreated extends Event { - public Cover $data; - - public function __construct(Cover $data, Request $request) + public function __construct(public Cover $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/EventCreated.php b/src/Events/EventCreated.php index 71d2469..1166c1f 100644 --- a/src/Events/EventCreated.php +++ b/src/Events/EventCreated.php @@ -9,11 +9,8 @@ class EventCreated extends Event { - public EventModel $data; - - public function __construct(EventModel $data, Request $request) + public function __construct(public EventModel $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/EventLogoCreated.php b/src/Events/EventLogoCreated.php index e56d233..5da3452 100644 --- a/src/Events/EventLogoCreated.php +++ b/src/Events/EventLogoCreated.php @@ -9,11 +9,8 @@ class EventLogoCreated extends Event { - public EventLogo $data; - - public function __construct(EventLogo $data, Request $request) + public function __construct(public EventLogo $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/EventNetworkCreated.php b/src/Events/EventNetworkCreated.php index 4a6ac64..2835f09 100644 --- a/src/Events/EventNetworkCreated.php +++ b/src/Events/EventNetworkCreated.php @@ -9,11 +9,8 @@ class EventNetworkCreated extends Event { - public EventNetwork $data; - - public function __construct(EventNetwork $data, Request $request) + public function __construct(public EventNetwork $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/ExternalGameCreated.php b/src/Events/ExternalGameCreated.php index ac06974..9919201 100644 --- a/src/Events/ExternalGameCreated.php +++ b/src/Events/ExternalGameCreated.php @@ -9,11 +9,8 @@ class ExternalGameCreated extends Event { - public ExternalGame $data; - - public function __construct(ExternalGame $data, Request $request) + public function __construct(public ExternalGame $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/FranchiseCreated.php b/src/Events/FranchiseCreated.php index a92609b..6bfe49e 100644 --- a/src/Events/FranchiseCreated.php +++ b/src/Events/FranchiseCreated.php @@ -9,11 +9,8 @@ class FranchiseCreated extends Event { - public Franchise $data; - - public function __construct(Franchise $data, Request $request) + public function __construct(public Franchise $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameCreated.php b/src/Events/GameCreated.php index 9ea0073..b587fb4 100644 --- a/src/Events/GameCreated.php +++ b/src/Events/GameCreated.php @@ -9,11 +9,8 @@ class GameCreated extends Event { - public Game $data; - - public function __construct(Game $data, Request $request) + public function __construct(public Game $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameEngineCreated.php b/src/Events/GameEngineCreated.php index 680b0ca..8a4bcce 100644 --- a/src/Events/GameEngineCreated.php +++ b/src/Events/GameEngineCreated.php @@ -9,11 +9,8 @@ class GameEngineCreated extends Event { - public GameEngine $data; - - public function __construct(GameEngine $data, Request $request) + public function __construct(public GameEngine $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameEngineLogoCreated.php b/src/Events/GameEngineLogoCreated.php index ca12005..4e71fa1 100644 --- a/src/Events/GameEngineLogoCreated.php +++ b/src/Events/GameEngineLogoCreated.php @@ -9,11 +9,8 @@ class GameEngineLogoCreated extends Event { - public GameEngineLogo $data; - - public function __construct(GameEngineLogo $data, Request $request) + public function __construct(public GameEngineLogo $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameLocalizationCreated.php b/src/Events/GameLocalizationCreated.php index 606ceef..d8207a9 100644 --- a/src/Events/GameLocalizationCreated.php +++ b/src/Events/GameLocalizationCreated.php @@ -9,11 +9,8 @@ class GameLocalizationCreated extends Event { - public GameLocalization $data; - - public function __construct(GameLocalization $data, Request $request) + public function __construct(public GameLocalization $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameModeCreated.php b/src/Events/GameModeCreated.php index 98bb00f..af59957 100644 --- a/src/Events/GameModeCreated.php +++ b/src/Events/GameModeCreated.php @@ -9,11 +9,8 @@ class GameModeCreated extends Event { - public GameMode $data; - - public function __construct(GameMode $data, Request $request) + public function __construct(public GameMode $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameVersionCreated.php b/src/Events/GameVersionCreated.php index 39da7a8..ec19a7a 100644 --- a/src/Events/GameVersionCreated.php +++ b/src/Events/GameVersionCreated.php @@ -9,11 +9,8 @@ class GameVersionCreated extends Event { - public GameVersion $data; - - public function __construct(GameVersion $data, Request $request) + public function __construct(public GameVersion $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameVersionFeatureCreated.php b/src/Events/GameVersionFeatureCreated.php index 238e49f..23f03d0 100644 --- a/src/Events/GameVersionFeatureCreated.php +++ b/src/Events/GameVersionFeatureCreated.php @@ -9,11 +9,8 @@ class GameVersionFeatureCreated extends Event { - public GameVersionFeature $data; - - public function __construct(GameVersionFeature $data, Request $request) + public function __construct(public GameVersionFeature $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameVersionFeatureValueCreated.php b/src/Events/GameVersionFeatureValueCreated.php index fa86c2d..b40b4d9 100644 --- a/src/Events/GameVersionFeatureValueCreated.php +++ b/src/Events/GameVersionFeatureValueCreated.php @@ -9,11 +9,8 @@ class GameVersionFeatureValueCreated extends Event { - public GameVersionFeatureValue $data; - - public function __construct(GameVersionFeatureValue $data, Request $request) + public function __construct(public GameVersionFeatureValue $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GameVideoCreated.php b/src/Events/GameVideoCreated.php index a9caef2..8993136 100644 --- a/src/Events/GameVideoCreated.php +++ b/src/Events/GameVideoCreated.php @@ -9,11 +9,8 @@ class GameVideoCreated extends Event { - public GameVideo $data; - - public function __construct(GameVideo $data, Request $request) + public function __construct(public GameVideo $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/GenreCreated.php b/src/Events/GenreCreated.php index 0cd1836..375c6f7 100644 --- a/src/Events/GenreCreated.php +++ b/src/Events/GenreCreated.php @@ -9,11 +9,8 @@ class GenreCreated extends Event { - public Genre $data; - - public function __construct(Genre $data, Request $request) + public function __construct(public Genre $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/InvolvedCompanyCreated.php b/src/Events/InvolvedCompanyCreated.php index ea5eaa5..d418af1 100644 --- a/src/Events/InvolvedCompanyCreated.php +++ b/src/Events/InvolvedCompanyCreated.php @@ -9,11 +9,8 @@ class InvolvedCompanyCreated extends Event { - public InvolvedCompany $data; - - public function __construct(InvolvedCompany $data, Request $request) + public function __construct(public InvolvedCompany $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/KeywordCreated.php b/src/Events/KeywordCreated.php index 1aec389..65d0da7 100644 --- a/src/Events/KeywordCreated.php +++ b/src/Events/KeywordCreated.php @@ -9,11 +9,8 @@ class KeywordCreated extends Event { - public Keyword $data; - - public function __construct(Keyword $data, Request $request) + public function __construct(public Keyword $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/LanguageCreated.php b/src/Events/LanguageCreated.php index d3f29db..6c003fc 100644 --- a/src/Events/LanguageCreated.php +++ b/src/Events/LanguageCreated.php @@ -9,11 +9,8 @@ class LanguageCreated extends Event { - public Language $data; - - public function __construct(Language $data, Request $request) + public function __construct(public Language $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/LanguageSupportCreated.php b/src/Events/LanguageSupportCreated.php index 3ae2152..d3888ad 100644 --- a/src/Events/LanguageSupportCreated.php +++ b/src/Events/LanguageSupportCreated.php @@ -9,11 +9,8 @@ class LanguageSupportCreated extends Event { - public LanguageSupport $data; - - public function __construct(LanguageSupport $data, Request $request) + public function __construct(public LanguageSupport $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/LanguageSupportTypeCreated.php b/src/Events/LanguageSupportTypeCreated.php index 53f62da..a974252 100644 --- a/src/Events/LanguageSupportTypeCreated.php +++ b/src/Events/LanguageSupportTypeCreated.php @@ -9,11 +9,8 @@ class LanguageSupportTypeCreated extends Event { - public LanguageSupportType $data; - - public function __construct(LanguageSupportType $data, Request $request) + public function __construct(public LanguageSupportType $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/MultiplayerModeCreated.php b/src/Events/MultiplayerModeCreated.php index 1140bee..4a2c3aa 100644 --- a/src/Events/MultiplayerModeCreated.php +++ b/src/Events/MultiplayerModeCreated.php @@ -9,11 +9,8 @@ class MultiplayerModeCreated extends Event { - public MultiplayerMode $data; - - public function __construct(MultiplayerMode $data, Request $request) + public function __construct(public MultiplayerMode $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/NetworkTypeCreated.php b/src/Events/NetworkTypeCreated.php index c620862..13a960b 100644 --- a/src/Events/NetworkTypeCreated.php +++ b/src/Events/NetworkTypeCreated.php @@ -9,11 +9,8 @@ class NetworkTypeCreated extends Event { - public NetworkType $data; - - public function __construct(NetworkType $data, Request $request) + public function __construct(public NetworkType $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlatformCreated.php b/src/Events/PlatformCreated.php index 378baaa..91ad365 100644 --- a/src/Events/PlatformCreated.php +++ b/src/Events/PlatformCreated.php @@ -9,11 +9,8 @@ class PlatformCreated extends Event { - public Platform $data; - - public function __construct(Platform $data, Request $request) + public function __construct(public Platform $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlatformFamilyCreated.php b/src/Events/PlatformFamilyCreated.php index 38512c8..74e3689 100644 --- a/src/Events/PlatformFamilyCreated.php +++ b/src/Events/PlatformFamilyCreated.php @@ -9,11 +9,8 @@ class PlatformFamilyCreated extends Event { - public PlatformFamily $data; - - public function __construct(PlatformFamily $data, Request $request) + public function __construct(public PlatformFamily $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlatformLogoCreated.php b/src/Events/PlatformLogoCreated.php index ee5e87e..65f53e3 100644 --- a/src/Events/PlatformLogoCreated.php +++ b/src/Events/PlatformLogoCreated.php @@ -9,11 +9,8 @@ class PlatformLogoCreated extends Event { - public PlatformLogo $data; - - public function __construct(PlatformLogo $data, Request $request) + public function __construct(public PlatformLogo $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlatformVersionCompanyCreated.php b/src/Events/PlatformVersionCompanyCreated.php index 333a5cd..d4dc4a4 100644 --- a/src/Events/PlatformVersionCompanyCreated.php +++ b/src/Events/PlatformVersionCompanyCreated.php @@ -9,11 +9,8 @@ class PlatformVersionCompanyCreated extends Event { - public PlatformVersionCompany $data; - - public function __construct(PlatformVersionCompany $data, Request $request) + public function __construct(public PlatformVersionCompany $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlatformVersionCreated.php b/src/Events/PlatformVersionCreated.php index 748dba6..e0a842b 100644 --- a/src/Events/PlatformVersionCreated.php +++ b/src/Events/PlatformVersionCreated.php @@ -9,11 +9,8 @@ class PlatformVersionCreated extends Event { - public PlatformVersion $data; - - public function __construct(PlatformVersion $data, Request $request) + public function __construct(public PlatformVersion $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlatformVersionReleaseDateCreated.php b/src/Events/PlatformVersionReleaseDateCreated.php index 6b1f13c..c84a2d1 100644 --- a/src/Events/PlatformVersionReleaseDateCreated.php +++ b/src/Events/PlatformVersionReleaseDateCreated.php @@ -9,11 +9,8 @@ class PlatformVersionReleaseDateCreated extends Event { - public PlatformVersionReleaseDate $data; - - public function __construct(PlatformVersionReleaseDate $data, Request $request) + public function __construct(public PlatformVersionReleaseDate $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlatformWebsiteCreated.php b/src/Events/PlatformWebsiteCreated.php index e0a1f78..3e63d25 100644 --- a/src/Events/PlatformWebsiteCreated.php +++ b/src/Events/PlatformWebsiteCreated.php @@ -9,11 +9,8 @@ class PlatformWebsiteCreated extends Event { - public PlatformWebsite $data; - - public function __construct(PlatformWebsite $data, Request $request) + public function __construct(public PlatformWebsite $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PlayerPerspectiveCreated.php b/src/Events/PlayerPerspectiveCreated.php index 93a8c82..d012683 100644 --- a/src/Events/PlayerPerspectiveCreated.php +++ b/src/Events/PlayerPerspectiveCreated.php @@ -9,11 +9,8 @@ class PlayerPerspectiveCreated extends Event { - public PlayerPerspective $data; - - public function __construct(PlayerPerspective $data, Request $request) + public function __construct(public PlayerPerspective $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/PopularityTypeCreated.php b/src/Events/PopularityTypeCreated.php index 8fa8846..97f48df 100644 --- a/src/Events/PopularityTypeCreated.php +++ b/src/Events/PopularityTypeCreated.php @@ -9,11 +9,8 @@ class PopularityTypeCreated extends Event { - public PopularityType $data; - - public function __construct(PopularityType $data, Request $request) + public function __construct(public PopularityType $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/RegionCreated.php b/src/Events/RegionCreated.php index b2f3082..2fa3f10 100644 --- a/src/Events/RegionCreated.php +++ b/src/Events/RegionCreated.php @@ -9,11 +9,8 @@ class RegionCreated extends Event { - public Region $data; - - public function __construct(Region $data, Request $request) + public function __construct(public Region $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/ReleaseDateCreated.php b/src/Events/ReleaseDateCreated.php index 6c024e5..fd6b123 100644 --- a/src/Events/ReleaseDateCreated.php +++ b/src/Events/ReleaseDateCreated.php @@ -9,11 +9,8 @@ class ReleaseDateCreated extends Event { - public ReleaseDate $data; - - public function __construct(ReleaseDate $data, Request $request) + public function __construct(public ReleaseDate $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/ReleaseDateStatusCreated.php b/src/Events/ReleaseDateStatusCreated.php index 2d066b8..a20626d 100644 --- a/src/Events/ReleaseDateStatusCreated.php +++ b/src/Events/ReleaseDateStatusCreated.php @@ -9,11 +9,8 @@ class ReleaseDateStatusCreated extends Event { - public ReleaseDateStatus $data; - - public function __construct(ReleaseDateStatus $data, Request $request) + public function __construct(public ReleaseDateStatus $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/ScreenshotCreated.php b/src/Events/ScreenshotCreated.php index c933e84..8e40b43 100644 --- a/src/Events/ScreenshotCreated.php +++ b/src/Events/ScreenshotCreated.php @@ -9,11 +9,8 @@ class ScreenshotCreated extends Event { - public Screenshot $data; - - public function __construct(Screenshot $data, Request $request) + public function __construct(public Screenshot $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/ThemeCreated.php b/src/Events/ThemeCreated.php index 5721a04..2c68f0e 100644 --- a/src/Events/ThemeCreated.php +++ b/src/Events/ThemeCreated.php @@ -9,11 +9,8 @@ class ThemeCreated extends Event { - public Theme $data; - - public function __construct(Theme $data, Request $request) + public function __construct(public Theme $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Events/WebsiteCreated.php b/src/Events/WebsiteCreated.php index 202773d..8699686 100644 --- a/src/Events/WebsiteCreated.php +++ b/src/Events/WebsiteCreated.php @@ -9,11 +9,8 @@ class WebsiteCreated extends Event { - public Website $data; - - public function __construct(Website $data, Request $request) + public function __construct(public Website $data, Request $request) { parent::__construct($request); - $this->data = $data; } } diff --git a/src/Models/Model.php b/src/Models/Model.php index c4b4dbe..0c50602 100644 --- a/src/Models/Model.php +++ b/src/Models/Model.php @@ -176,9 +176,9 @@ protected function setIdentifier(): void protected function setAttributes(array $attributes): void { - $this->attributes = collect($attributes)->filter(function (mixed $value) { + $this->attributes = collect($attributes)->filter(static function (mixed $value) { if (is_array($value)) { - return collect($value)->filter(fn (mixed $value) => is_object($value))->isEmpty(); + return collect($value)->filter(static fn (mixed $value) => is_object($value))->isEmpty(); } return !is_object($value); @@ -203,7 +203,7 @@ protected function setRelations(array $attributes): void return $this->mapToModel($key, $value); }) - ->filter(fn (mixed $value): bool => $value instanceof Model || ($value instanceof Collection && !$value->isEmpty())); + ->filter(static fn (mixed $value): bool => $value instanceof Model || ($value instanceof Collection && !$value->isEmpty())); } public function forwardCallTo(mixed $object, mixed $method, mixed $parameters): mixed @@ -306,7 +306,7 @@ public function getEndpoint(): string public function toArray(): array { $attributes = collect($this->attributes); - $relations = $this->relations->map(function (mixed $relation) { + $relations = $this->relations->map(static function (mixed $relation) { if (!$relation instanceof Arrayable) { return $relation; } diff --git a/src/Models/Webhook.php b/src/Models/Webhook.php index 07a8c7f..144fd21 100644 --- a/src/Models/Webhook.php +++ b/src/Models/Webhook.php @@ -72,7 +72,7 @@ public static function find(int $id): ?self public function delete(): mixed { - if (!$this->id) { + if ($this->id === 0) { return false; } @@ -150,7 +150,7 @@ public static function validate(Request $request): void public function getModel(): string { $categories = collect(Category::cases()) - ->mapWithKeys(fn (Category $category) => [(string) $category->value => $category->name]); + ->mapWithKeys(static fn (Category $category) => [(string) $category->value => $category->name]); $category = $categories->get($this->category); @@ -189,7 +189,7 @@ public function toArray(): array private function fill(mixed ...$parameters): void { - if ($parameters) { + if ($parameters !== []) { foreach ($parameters as $parameter => $value) { if (property_exists($this, (string) $parameter)) { if (in_array($parameter, ['created_at', 'updated_at'])) { @@ -204,7 +204,7 @@ private function fill(mixed ...$parameters): void private function mapToModel(\Illuminate\Support\Collection $collection): \Illuminate\Support\Collection { - return $collection->map(function (array $item) { + return $collection->map(static function (array $item) { $webhook = new self(...$item); unset($webhook->client); diff --git a/src/Traits/HasSearch.php b/src/Traits/HasSearch.php index a0568d6..52dc485 100644 --- a/src/Traits/HasSearch.php +++ b/src/Traits/HasSearch.php @@ -40,7 +40,7 @@ public function fuzzySearch( $tokenizedQuery = explode(' ', $query); $keys = collect($key)->crossJoin($tokenizedQuery)->toArray(); - return $this->whereNested(function (Builder $query) use ($keys, $caseSensitive): void { + return $this->whereNested(static function (Builder $query) use ($keys, $caseSensitive): void { foreach ($keys as $v) { if (is_array($v)) { $query->whereLike($v[0], $v[1], $caseSensitive, '|'); diff --git a/src/Traits/HasSelect.php b/src/Traits/HasSelect.php index 71c863b..4895f85 100644 --- a/src/Traits/HasSelect.php +++ b/src/Traits/HasSelect.php @@ -21,7 +21,7 @@ public function select(mixed $fields): self $collection->push('*'); } - $collection = $collection->filter(fn (string $field) => !strpos($field, '.'))->flatten(); + $collection = $collection->filter(static fn (string $field) => !strpos($field, '.'))->flatten(); if ($collection->isEmpty()) { $collection->push('*'); diff --git a/src/Traits/HasWhere.php b/src/Traits/HasWhere.php index 107b3d1..ca4f15e 100644 --- a/src/Traits/HasWhere.php +++ b/src/Traits/HasWhere.php @@ -122,7 +122,7 @@ protected function addArrayOfWheres( string $boolean, string $method = 'where', ): self { - return $this->whereNested(function (Builder $query) use ( + return $this->whereNested(static function (Builder $query) use ( $arrayOfWheres, $method, $boolean diff --git a/src/Traits/HasWhereBetween.php b/src/Traits/HasWhereBetween.php index df1d604..77f2b57 100644 --- a/src/Traits/HasWhereBetween.php +++ b/src/Traits/HasWhereBetween.php @@ -30,7 +30,7 @@ public function whereBetween( $second = $this->castDate($second); } - $this->whereNested(function (Builder $query) use ( + $this->whereNested(static function (Builder $query) use ( $key, $first, $second, @@ -79,7 +79,7 @@ public function whereNotBetween( $second = $this->castDate($second); } - $this->whereNested(function (Builder $query) use ( + $this->whereNested(static function (Builder $query) use ( $key, $first, $second, diff --git a/src/Traits/HasWhereIn.php b/src/Traits/HasWhereIn.php index 3768f85..05e3cc3 100644 --- a/src/Traits/HasWhereIn.php +++ b/src/Traits/HasWhereIn.php @@ -31,7 +31,7 @@ public function whereIn( $where = $this->query->get('where', new Collection()); - $valuesString = collect($values)->map(fn (mixed $value) => !is_numeric($value) ? '"' . $value . '"' : $value)->implode(','); + $valuesString = collect($values)->map(static fn (mixed $value) => !is_numeric($value) ? '"' . $value . '"' : $value)->implode(','); $where->push(($where->count() ? $boolean . ' ' : '') . $key . ' ' . $operator . ' ' . $prefix . $valuesString . $suffix); diff --git a/tests/BuilderTest.php b/tests/BuilderTest.php index d2a0a40..4b120b3 100644 --- a/tests/BuilderTest.php +++ b/tests/BuilderTest.php @@ -15,6 +15,7 @@ use MarcReichel\IGDBLaravel\Exceptions\InvalidParamsException; use MarcReichel\IGDBLaravel\Exceptions\MissingEndpointException; use MarcReichel\IGDBLaravel\Exceptions\ModelNotFoundException; +use PHPUnit\Framework\Attributes\DataProvider; use ReflectionException; use stdClass; @@ -95,13 +96,11 @@ public function testItShouldGenerateFuzzySearchQuery(): void { $this->igdb->fuzzySearch(['name', 'company'], 'phpunit test')->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);', + )); } /** @@ -111,13 +110,11 @@ public function testItShouldGenerateOrFuzzySearchQuery(): void { $this->igdb->where('name', 'Fortnite')->orFuzzySearch(['name', 'company'], 'phpunit test')->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where name = "Fortnite" | (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where name = "Fortnite" | (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);', + )); } /** @@ -145,18 +142,16 @@ public function testItShouldGenerateNestedWhereQuery(): void { $now = Carbon::now()->timestamp; $nextYear = Carbon::now()->addYear()->timestamp; - $this->igdb->where(function ($query) use ($now, $nextYear): void { + $this->igdb->where(static function ($query) use ($now, $nextYear): void { $query->where('first_release_date', '>=', $now) ->where('first_release_date', '<=', $nextYear); })->orWhere('name', 'Fortnite')->get(); - Http::assertSent(function (Request $request) use ($now, $nextYear) { - return $this->isApiCall( - $request, - 'games', - "where (first_release_date >= $now & first_release_date <= $nextYear) | name = \"Fortnite\";", - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + "where (first_release_date >= $now & first_release_date <= $nextYear) | name = \"Fortnite\";", + )); } /** @@ -213,13 +208,13 @@ public static function datesDataProvider(): array } /** - * @dataProvider datesDataProvider * * @throws ReflectionException * @throws InvalidParamsException * @throws JsonException * @throws MissingEndpointException */ + #[DataProvider('datesDataProvider')] public function testItShouldCastDateStrings(string $key): void { $dateString = '2024-01-01'; @@ -231,13 +226,13 @@ public function testItShouldCastDateStrings(string $key): void } /** - * @dataProvider datesDataProvider * * @throws MissingEndpointException * @throws ReflectionException * @throws InvalidParamsException * @throws JsonException */ + #[DataProvider('datesDataProvider')] public function testItShouldCastCarbonInstances(string $key): void { $now = Carbon::now(); @@ -371,43 +366,35 @@ public function testItShouldGenerateWhereBetweenQuery(): void { $this->igdb->whereBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where (first_release_date >= 1546297200 & first_release_date <= 1577833199);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where (first_release_date >= 1546297200 & first_release_date <= 1577833199);', + )); $this->igdb->where('name', 'Fortnite')->orWhereBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where name = "Fortnite" | (first_release_date >= 1546297200 & first_release_date <= 1577833199);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where name = "Fortnite" | (first_release_date >= 1546297200 & first_release_date <= 1577833199);', + )); $this->igdb->whereNotBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where (first_release_date < 1546297200 | first_release_date > 1577833199);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where (first_release_date < 1546297200 | first_release_date > 1577833199);', + )); $this->igdb->where('name', 'Fortnite')->orWhereNotBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where name = "Fortnite" | (first_release_date < 1546297200 | first_release_date > 1577833199);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where name = "Fortnite" | (first_release_date < 1546297200 | first_release_date > 1577833199);', + )); } /** @@ -417,13 +404,11 @@ public function testItShouldGenerateWhereBetweenQueryWithoutBoundaries(): void { $this->igdb->whereBetween('first_release_date', 1546297200, 1577833199, false)->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where (first_release_date > 1546297200 & first_release_date < 1577833199);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where (first_release_date > 1546297200 & first_release_date < 1577833199);', + )); } /** @@ -549,23 +534,19 @@ public function testItShouldGenerateWhereDateEqualsQuery(): void $this->igdb->whereDate('first_release_date', $date->format('Y-m-d'))->get(); - Http::assertSent(function (Request $request) use ($start, $end) { - return $this->isApiCall( - $request, - 'games', - "where (first_release_date >= $start & first_release_date <= $end);", - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + "where (first_release_date >= $start & first_release_date <= $end);", + )); $this->igdb->where('name', 'Fortnite')->orWhereDate('first_release_date', $date->format('Y-m-d'))->get(); - Http::assertSent(function (Request $request) use ($start, $end) { - return $this->isApiCall( - $request, - 'games', - "where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);", - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + "where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);", + )); } /** @@ -665,23 +646,19 @@ public function testItShouldGenerateWhereYearEqualsQuery(): void $this->igdb->whereYear('first_release_date', $date->year)->get(); - Http::assertSent(function (Request $request) use ($start, $end) { - return $this->isApiCall( - $request, - 'games', - "where (first_release_date >= $start & first_release_date <= $end);", - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + "where (first_release_date >= $start & first_release_date <= $end);", + )); $this->igdb->where('name', 'Fortnite')->orWhereYear('first_release_date', $date->year)->get(); - Http::assertSent(function (Request $request) use ($start, $end) { - return $this->isApiCall( - $request, - 'games', - "where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);", - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + "where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);", + )); } /** @@ -770,18 +747,16 @@ public function testItShouldGenerateWhereHasNotQuery(): void public function testItShouldGenerateNestedOrWhereQuery(): void { $this->igdb->where('name', 'Fortnite') - ->orWhere(function ($query): void { + ->orWhere(static function ($query): void { $query->where('aggregated_rating', '>=', 90) ->where('aggregated_rating_count', '>=', 3000); })->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where name = "Fortnite" | (aggregated_rating >= 90 & aggregated_rating_count >= 3000);', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where name = "Fortnite" | (aggregated_rating >= 90 & aggregated_rating_count >= 3000);', + )); } /** @@ -795,25 +770,21 @@ public function testItShouldGenerateArrayWhereQuery(): void $this->igdb->where('name', 'Fortnite')->orWhere([['name', 'Call of Duty'], ['name', 'Borderlands 2']])->get(); - Http::assertSent(function (Request $request) { - return $this->isApiCall( - $request, - 'games', - 'where name = "Fortnite" | (name = "Call of Duty" & name = "Borderlands 2");', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where name = "Fortnite" | (name = "Call of Duty" & name = "Borderlands 2");', + )); $now = Carbon::now()->timestamp; $this->igdb->where('name', 'Fortnite')->where(['name' => 'Borderlands', 'first_release_date' => $now])->get(); - Http::assertSent(function (Request $request) use ($now) { - return $this->isApiCall( - $request, - 'games', - 'where name = "Fortnite" & (name = "Borderlands" & first_release_date = ' . $now . ');', - ); - }); + Http::assertSent(fn(Request $request) => $this->isApiCall( + $request, + 'games', + 'where name = "Fortnite" & (name = "Borderlands" & first_release_date = ' . $now . ');', + )); } /** diff --git a/tests/EventsTest.php b/tests/EventsTest.php index 976907f..f344d4b 100644 --- a/tests/EventsTest.php +++ b/tests/EventsTest.php @@ -4,32 +4,28 @@ namespace MarcReichel\IGDBLaravel\Tests; +use PHPUnit\Framework\Attributes\DataProvider; + /** * @internal */ class EventsTest extends TestCase { - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldHaveCreatedEventForEveryModel(string $className): void { $eventClassString = 'MarcReichel\IGDBLaravel\Events\\' . $className . 'Created'; $this->assertTrue(class_exists($eventClassString)); } - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldHaveUpdatedEventForEveryModel(string $className): void { $eventClassString = 'MarcReichel\IGDBLaravel\Events\\' . $className . 'Updated'; $this->assertTrue(class_exists($eventClassString)); } - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldHaveDeletedEventForEveryModel(string $className): void { $eventClassString = 'MarcReichel\IGDBLaravel\Events\\' . $className . 'Deleted'; diff --git a/tests/ImageTest.php b/tests/ImageTest.php index 0c460b2..fd43818 100644 --- a/tests/ImageTest.php +++ b/tests/ImageTest.php @@ -16,6 +16,7 @@ use MarcReichel\IGDBLaravel\Models\Image; use MarcReichel\IGDBLaravel\Models\PlatformLogo; use MarcReichel\IGDBLaravel\Models\Screenshot; +use PHPUnit\Framework\Attributes\DataProvider; /** * @internal @@ -98,9 +99,7 @@ public function testItShouldGenerateDefaultImageUrlWithoutAttributes(): void self::assertEquals('//images.igdb.com/igdb/image/upload/t_thumb/abc.jpg', $url); } - /** - * @dataProvider imageSizeDataProvider - */ + #[DataProvider('imageSizeDataProvider')] public function testItShouldGenerateDesiredImageUrlWithParameter(Size | string $size, string $value): void { $url = Artwork::first()?->getUrl($size); @@ -108,9 +107,7 @@ public function testItShouldGenerateDesiredImageUrlWithParameter(Size | string $ self::assertEquals('//images.igdb.com/igdb/image/upload/t_' . $value . '/abc.jpg', $url); } - /** - * @dataProvider imageSizeDataProvider - */ + #[DataProvider('imageSizeDataProvider')] public function testItShouldGenerateRetinaImageUrl(Size | string $size, string $value): void { $url = Artwork::first()?->getUrl($size, true); diff --git a/tests/ModelTest.php b/tests/ModelTest.php index 2382ebf..b413c94 100644 --- a/tests/ModelTest.php +++ b/tests/ModelTest.php @@ -12,6 +12,7 @@ use MarcReichel\IGDBLaravel\Exceptions\ModelNotFoundException; use MarcReichel\IGDBLaravel\Models\Game; use MarcReichel\IGDBLaravel\Models\Model; +use PHPUnit\Framework\Attributes\DataProvider; /** * @internal @@ -274,7 +275,7 @@ public function testItShouldGenerateWhereHasNotQuery(): void public function testItShouldGenerateNestedWhereQuery(): void { Game::where('name', 'Fortnite') - ->orWhere(function ($query): void { + ->orWhere(static function ($query): void { $query->where('aggregated_rating', '>=', 90) ->where('aggregated_rating_count', '>=', 3000); })->get(); @@ -424,9 +425,7 @@ public function testItShouldThrowExceptionWhenBadMethodIsCalled(): void Game::foo(); } - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldNotHaveInvalidCasts(string $className): void { /** @var class-string $fqcn */ diff --git a/tests/TestCase.php b/tests/TestCase.php index 5070fe1..d25ac49 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -109,7 +109,9 @@ public static function modelsDataProvider(): array continue; } - $classNames[] = [class_basename($classString)]; + $classBasename = class_basename($classString); + + $classNames[$classBasename] = [$classBasename]; } return $classNames; diff --git a/tests/WebhookTest.php b/tests/WebhookTest.php index 257d2f5..e618ebb 100644 --- a/tests/WebhookTest.php +++ b/tests/WebhookTest.php @@ -17,6 +17,7 @@ use MarcReichel\IGDBLaravel\Models\Company; use MarcReichel\IGDBLaravel\Models\Game; use MarcReichel\IGDBLaravel\Models\Webhook; +use PHPUnit\Framework\Attributes\DataProvider; /** * @internal @@ -30,7 +31,7 @@ protected function setUp(): void { parent::setUp(); - $this->hash = substr(md5(config('igdb.credentials.client_id')), 0, 8); + $this->hash = substr(md5((string) config('igdb.credentials.client_id')), 0, 8); $this->prefix = 'igdb-webhook/handle/' . $this->hash; Cache::put('igdb_cache.access_token', 'some-token'); @@ -114,9 +115,7 @@ public function testItShouldThrowExceptionWhenNoSecretIsSet(): void Game::createWebhook(Method::CREATE); } - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldDispatchCreatedEvent(string $className): void { $eventClassString = 'MarcReichel\IGDBLaravel\Events\\' . $className . 'Created'; @@ -132,9 +131,7 @@ public function testItShouldDispatchCreatedEvent(string $className): void Event::assertDispatched($eventClassString); } - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldDispatchUpdatedEvent(string $className): void { $eventClassString = 'MarcReichel\IGDBLaravel\Events\\' . $className . 'Updated'; @@ -150,9 +147,7 @@ public function testItShouldDispatchUpdatedEvent(string $className): void Event::assertDispatched($eventClassString); } - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldDispatchDeletedEvent(string $className): void { $eventClassString = 'MarcReichel\IGDBLaravel\Events\\' . $className . 'Deleted'; @@ -168,13 +163,11 @@ public function testItShouldDispatchDeletedEvent(string $className): void Event::assertDispatched($eventClassString); } - /** - * @dataProvider modelsDataProvider - */ + #[DataProvider('modelsDataProvider')] public function testItShouldHaveACategoryCaseForEveryModel(string $className): void { $categories = collect(Category::cases()) - ->map(fn (Category $category) => $category->name) + ->map(static fn (Category $category) => $category->name) ->values() ->toArray(); From 7d5d3adb3a4f203805df435d20b34264207e8b70 Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Fri, 24 Jan 2025 19:41:47 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=20Code=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Console/CreateWebhook.php | 2 +- src/Console/ReactivateWebhook.php | 2 +- src/Traits/HasWhere.php | 2 +- tests/BuilderTest.php | 32 +++++++++++++++---------------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/Console/CreateWebhook.php b/src/Console/CreateWebhook.php index ae1f0ef..abcdc70 100644 --- a/src/Console/CreateWebhook.php +++ b/src/Console/CreateWebhook.php @@ -51,7 +51,7 @@ public function handle(): int $fullQualifiedName = $namespace . $closestModel; } - /** @var Model $class */ + /** @var class-string $class */ $class = $fullQualifiedName; $methods = ['create', 'update', 'delete']; diff --git a/src/Console/ReactivateWebhook.php b/src/Console/ReactivateWebhook.php index 5305777..7bfab0a 100644 --- a/src/Console/ReactivateWebhook.php +++ b/src/Console/ReactivateWebhook.php @@ -50,7 +50,7 @@ public function handle(): int return self::FAILURE; } - /** @var Model $class */ + /** @var class-string $class */ $class = $fullQualifiedName; try { diff --git a/src/Traits/HasWhere.php b/src/Traits/HasWhere.php index ca4f15e..00785c1 100644 --- a/src/Traits/HasWhere.php +++ b/src/Traits/HasWhere.php @@ -90,7 +90,7 @@ public function where( */ public function orWhere( mixed $key, - string $operator = null, + ?string $operator = null, mixed $value = null, string $boolean = '|', ): self { diff --git a/tests/BuilderTest.php b/tests/BuilderTest.php index 4b120b3..91e8df3 100644 --- a/tests/BuilderTest.php +++ b/tests/BuilderTest.php @@ -96,7 +96,7 @@ public function testItShouldGenerateFuzzySearchQuery(): void { $this->igdb->fuzzySearch(['name', 'company'], 'phpunit test')->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);', @@ -110,7 +110,7 @@ public function testItShouldGenerateOrFuzzySearchQuery(): void { $this->igdb->where('name', 'Fortnite')->orFuzzySearch(['name', 'company'], 'phpunit test')->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where name = "Fortnite" | (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);', @@ -147,7 +147,7 @@ public function testItShouldGenerateNestedWhereQuery(): void ->where('first_release_date', '<=', $nextYear); })->orWhere('name', 'Fortnite')->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', "where (first_release_date >= $now & first_release_date <= $nextYear) | name = \"Fortnite\";", @@ -208,7 +208,6 @@ public static function datesDataProvider(): array } /** - * * @throws ReflectionException * @throws InvalidParamsException * @throws JsonException @@ -226,7 +225,6 @@ public function testItShouldCastDateStrings(string $key): void } /** - * * @throws MissingEndpointException * @throws ReflectionException * @throws InvalidParamsException @@ -366,7 +364,7 @@ public function testItShouldGenerateWhereBetweenQuery(): void { $this->igdb->whereBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where (first_release_date >= 1546297200 & first_release_date <= 1577833199);', @@ -374,7 +372,7 @@ public function testItShouldGenerateWhereBetweenQuery(): void $this->igdb->where('name', 'Fortnite')->orWhereBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where name = "Fortnite" | (first_release_date >= 1546297200 & first_release_date <= 1577833199);', @@ -382,7 +380,7 @@ public function testItShouldGenerateWhereBetweenQuery(): void $this->igdb->whereNotBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where (first_release_date < 1546297200 | first_release_date > 1577833199);', @@ -390,7 +388,7 @@ public function testItShouldGenerateWhereBetweenQuery(): void $this->igdb->where('name', 'Fortnite')->orWhereNotBetween('first_release_date', 1546297200, 1577833199)->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where name = "Fortnite" | (first_release_date < 1546297200 | first_release_date > 1577833199);', @@ -404,7 +402,7 @@ public function testItShouldGenerateWhereBetweenQueryWithoutBoundaries(): void { $this->igdb->whereBetween('first_release_date', 1546297200, 1577833199, false)->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where (first_release_date > 1546297200 & first_release_date < 1577833199);', @@ -534,7 +532,7 @@ public function testItShouldGenerateWhereDateEqualsQuery(): void $this->igdb->whereDate('first_release_date', $date->format('Y-m-d'))->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', "where (first_release_date >= $start & first_release_date <= $end);", @@ -542,7 +540,7 @@ public function testItShouldGenerateWhereDateEqualsQuery(): void $this->igdb->where('name', 'Fortnite')->orWhereDate('first_release_date', $date->format('Y-m-d'))->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', "where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);", @@ -646,7 +644,7 @@ public function testItShouldGenerateWhereYearEqualsQuery(): void $this->igdb->whereYear('first_release_date', $date->year)->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', "where (first_release_date >= $start & first_release_date <= $end);", @@ -654,7 +652,7 @@ public function testItShouldGenerateWhereYearEqualsQuery(): void $this->igdb->where('name', 'Fortnite')->orWhereYear('first_release_date', $date->year)->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', "where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);", @@ -752,7 +750,7 @@ public function testItShouldGenerateNestedOrWhereQuery(): void ->where('aggregated_rating_count', '>=', 3000); })->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where name = "Fortnite" | (aggregated_rating >= 90 & aggregated_rating_count >= 3000);', @@ -770,7 +768,7 @@ public function testItShouldGenerateArrayWhereQuery(): void $this->igdb->where('name', 'Fortnite')->orWhere([['name', 'Call of Duty'], ['name', 'Borderlands 2']])->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where name = "Fortnite" | (name = "Call of Duty" & name = "Borderlands 2");', @@ -780,7 +778,7 @@ public function testItShouldGenerateArrayWhereQuery(): void $this->igdb->where('name', 'Fortnite')->where(['name' => 'Borderlands', 'first_release_date' => $now])->get(); - Http::assertSent(fn(Request $request) => $this->isApiCall( + Http::assertSent(fn (Request $request) => $this->isApiCall( $request, 'games', 'where name = "Fortnite" & (name = "Borderlands" & first_release_date = ' . $now . ');', From 288e32e0c3ee4050ddb444d45212087bce6f7a72 Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Fri, 24 Jan 2025 19:44:09 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9E=96=20Drop=20support=20for=20PHP=208.?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4a7b777..5ef9cd0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.4, 8.3, 8.2, 8.1] + php: [8.4, 8.3, 8.2] laravel: ['10.*', '11.*'] stability: [prefer-stable] include: diff --git a/composer.json b/composer.json index 2b25e0d..f9b6321 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "type": "library", "minimum-stability": "stable", "require": { - "php": "^8.1", + "php": "^8.2", "ext-json": "*", "illuminate/support": "^9.0|^10.0|^11.0", "guzzlehttp/guzzle": "~6.0|~7.0", From c20297f72fee34fbca1723d5c856e99f09f1f748 Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Fri, 24 Jan 2025 19:48:57 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E2=9E=96=20Drop=20support=20for=20Laravel?= =?UTF-8?q?=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 7 +------ composer.json | 6 +++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ef9cd0..3a1f86c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,16 +14,11 @@ jobs: fail-fast: true matrix: php: [8.4, 8.3, 8.2] - laravel: ['10.*', '11.*'] + 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 }} diff --git a/composer.json b/composer.json index f9b6321..a5bf808 100644 --- a/composer.json +++ b/composer.json @@ -14,13 +14,13 @@ "require": { "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": { - "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": "^3.0.2", "laravel/pint": "^1.13",