diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 403ab66..1bfd540 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,8 +13,11 @@ jobs: strategy: fail-fast: true matrix: - php: [8.4, 8.3, 8.2] - laravel: ['^12.0'] + php: [8.5, 8.4, 8.3, 8.2] + laravel: [^12.0, ^13.0] + exclude: + - laravel: ^13.0 + php: 8.2 name: P${{ matrix.php }} - L${{ matrix.laravel }} diff --git a/composer.json b/composer.json index 6b19b33..460355f 100644 --- a/composer.json +++ b/composer.json @@ -1,59 +1,59 @@ { - "name": "dyrynda/laravel-model-uuid", - "description": "This package allows you to easily work with UUIDs in your Laravel models.", - "license": "MIT", - "keywords": [ - "eloquent", - "laravel", - "model", - "uuid" - ], - "authors": [ - { - "name": "Michael Dyrynda", - "email": "michael@dyrynda.com.au", - "homepage": "https://dyrynda.com.au" - } - ], - "require": { - "php": "^8.2", - "illuminate/container": "^12.0", - "illuminate/contracts": "^12.0", - "illuminate/database": "^12.0", - "illuminate/events": "^12.0", - "illuminate/support": "^12.0", - "ramsey/uuid": "^4.7", - "spatie/laravel-package-tools": "^1.19" - }, - "autoload": { - "psr-4": { - "Dyrynda\\Database\\Support\\": "src/" - } - }, - "require-dev": { - "laravel/legacy-factories": "^1.3", - "laravel/pint": "^1.20", - "orchestra/testbench": "^10.0", - "phpunit/phpunit": "^11.5.3" - }, - "autoload-dev": { - "psr-4": { - "Tests\\": "tests/" - } - }, - "minimum-stability": "dev", - "prefer-stable": true, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-main": "8.x-dev" + "name": "dyrynda/laravel-model-uuid", + "description": "This package allows you to easily work with UUIDs in your Laravel models.", + "license": "MIT", + "keywords": [ + "eloquent", + "laravel", + "model", + "uuid" + ], + "authors": [ + { + "name": "Michael Dyrynda", + "email": "michael@dyrynda.com.au", + "homepage": "https://dyrynda.com.au" + } + ], + "require": { + "php": "^8.2", + "illuminate/container": "^12.0|^13.0", + "illuminate/contracts": "^12.0|^13.0", + "illuminate/database": "^12.0|^13.0", + "illuminate/events": "^12.0|^13.0", + "illuminate/support": "^12.0|^13.0", + "ramsey/uuid": "^4.7", + "spatie/laravel-package-tools": "^1.39" + }, + "autoload": { + "psr-4": { + "Dyrynda\\Database\\Support\\": "src/" + } + }, + "require-dev": { + "laravel/legacy-factories": "^1.3", + "laravel/pint": "^1.20", + "orchestra/testbench": "^10.0|^11.0", + "phpunit/phpunit": "^11.5.3|^12.5.12" + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "sort-packages": true }, - "laravel": { - "providers": [ - "Dyrynda\\Database\\Support\\LaravelModelUuidServiceProvider" - ] + "extra": { + "branch-alias": { + "dev-main": "8.x-dev" + }, + "laravel": { + "providers": [ + "Dyrynda\\Database\\Support\\LaravelModelUuidServiceProvider" + ] + } } - } } diff --git a/src/Casts/EfficientUuid.php b/src/Casts/EfficientUuid.php index bee0e70..6cd80b2 100644 --- a/src/Casts/EfficientUuid.php +++ b/src/Casts/EfficientUuid.php @@ -3,6 +3,7 @@ namespace Dyrynda\Database\Support\Casts; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; +use Illuminate\Database\Eloquent\Model; use Ramsey\Uuid\Uuid; class EfficientUuid implements CastsAttributes @@ -10,7 +11,7 @@ class EfficientUuid implements CastsAttributes /** * Transform the attribute from the underlying model values. * - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model * @param mixed $value * @return mixed */ @@ -26,7 +27,7 @@ public function get($model, string $key, $value, array $attributes) /** * Transform the attribute to its underlying model values. * - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model * @param mixed $value * @return array */ diff --git a/src/GeneratesUuid.php b/src/GeneratesUuid.php index 3874b65..2491cca 100644 --- a/src/GeneratesUuid.php +++ b/src/GeneratesUuid.php @@ -119,7 +119,7 @@ public function resolveUuidVersion(): string /** * Scope queries to find by UUID. * - * @param \Illuminate\Database\Eloquent\Builder $query + * @param Builder $query * @param string|array $uuid * @param string $uuidColumn */ @@ -137,7 +137,7 @@ public function scopeWhereUuid($query, $uuid, $uuidColumn = null): Builder /** * Scope queries to find by UUID. * - * @param \Illuminate\Database\Eloquent\Builder $query + * @param Builder $query * @param string|array $uuid * @param string $uuidColumn */ @@ -155,7 +155,7 @@ public function scopeWhereNotUuid($query, $uuid, $uuidColumn = null): Builder /** * Convert a single UUID or array of UUIDs to bytes. * - * @param \Illuminate\Contracts\Support\Arrayable|array|string $uuid + * @param Arrayable|array|string $uuid */ protected function bytesFromUuid($uuid): array { @@ -173,7 +173,7 @@ protected function bytesFromUuid($uuid): array /** * Normalises a single or array of input UUIDs, filtering any invalid UUIDs. * - * @param \Illuminate\Contracts\Support\Arrayable|array|string $uuid + * @param Arrayable|array|string $uuid */ protected function normaliseUuids($uuid): array { diff --git a/src/LaravelModelUuidServiceProvider.php b/src/LaravelModelUuidServiceProvider.php index 014fb7b..5de3a00 100644 --- a/src/LaravelModelUuidServiceProvider.php +++ b/src/LaravelModelUuidServiceProvider.php @@ -35,7 +35,7 @@ public function packageRegistered() }); Blueprint::macro('efficientUuid', function ($column): ColumnDefinition { - /** @var \Illuminate\Database\Schema\Blueprint $this */ + /** @var Blueprint $this */ return $this->addColumn('efficientUuid', $column); }); } diff --git a/src/Rules/EfficientUuidExists.php b/src/Rules/EfficientUuidExists.php index 8d85617..2cc41a2 100644 --- a/src/Rules/EfficientUuidExists.php +++ b/src/Rules/EfficientUuidExists.php @@ -2,12 +2,13 @@ namespace Dyrynda\Database\Support\Rules; +use Dyrynda\Database\Support\GeneratesUuid; use Illuminate\Contracts\Validation\Rule; use Ramsey\Uuid\Uuid; class EfficientUuidExists implements Rule { - /** @var \Dyrynda\Database\Support\GeneratesUuid */ + /** @var GeneratesUuid */ protected $model; /** @var string */ diff --git a/tests/Feature/EfficientUuidExistsRuleTest.php b/tests/Feature/EfficientUuidExistsRuleTest.php index c62ed6b..8e1d8bf 100644 --- a/tests/Feature/EfficientUuidExistsRuleTest.php +++ b/tests/Feature/EfficientUuidExistsRuleTest.php @@ -13,7 +13,7 @@ class EfficientUuidExistsRuleTest extends TestCase #[Test] public function it_passes_valid_existing_uuid() { - /** @var \Tests\Fixtures\EfficientUuidPost $post */ + /** @var EfficientUuidPost $post */ $post = factory(EfficientUuidPost::class)->create(); $rule = new EfficientUuidExists(EfficientUuidPost::class, 'efficient_uuid'); @@ -44,7 +44,7 @@ public function it_fails_on_any_non_uuid_invalid_strings() #[Test] public function it_works_with_custom_uuid_column_name() { - /** @var \Tests\Fixtures\EfficientUuidPost $post */ + /** @var EfficientUuidPost $post */ $post = factory(EfficientUuidPost::class)->create(); $rule = new EfficientUuidExists(EfficientUuidPost::class, 'custom_efficient_uuid'); diff --git a/tests/database/factories/CommentFactory.php b/tests/database/factories/CommentFactory.php index 0ad46f0..4e4f9ed 100644 --- a/tests/database/factories/CommentFactory.php +++ b/tests/database/factories/CommentFactory.php @@ -1,8 +1,9 @@