From ff8650a19bb66304d5bcd7a3dca84e572cad05f7 Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Sat, 13 Jul 2024 11:02:52 +0400 Subject: [PATCH] PHPStan fixes. --- .../src/Testing/Package/Models/TestObject.php | 9 ++++----- packages/graphql/src/Stream/Directives/Directive.php | 2 +- packages/graphql/src/Stream/Directives/OffsetTest.php | 2 +- .../src/Testing/Package/Data/Models/TestObject.php | 9 ++++----- .../Package/Data/Models/TestObjectSearchable.php | 11 +++++------ packages/migrator/src/Extenders/SmartMigrator.php | 4 +--- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/packages/eloquent/src/Testing/Package/Models/TestObject.php b/packages/eloquent/src/Testing/Package/Models/TestObject.php index b40952961..c16f2cdb4 100644 --- a/packages/eloquent/src/Testing/Package/Models/TestObject.php +++ b/packages/eloquent/src/Testing/Package/Models/TestObject.php @@ -2,7 +2,6 @@ namespace LastDragon_ru\LaraASP\Eloquent\Testing\Package\Models; -use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use LastDragon_ru\LaraASP\Eloquent\Concerns\WithoutTimestamps; @@ -11,6 +10,9 @@ * @internal */ class TestObject extends Model { + /** + * @use HasFactory + */ use HasFactory; use WithoutTimestamps; @@ -20,10 +22,7 @@ class TestObject extends Model { */ protected $table = 'test_objects'; - /** - * @return Factory - */ - protected static function newFactory(): Factory { + protected static function newFactory(): TestObjectFactory { return TestObjectFactory::new(); } } diff --git a/packages/graphql/src/Stream/Directives/Directive.php b/packages/graphql/src/Stream/Directives/Directive.php index 90d7c9600..9b5d387d2 100644 --- a/packages/graphql/src/Stream/Directives/Directive.php +++ b/packages/graphql/src/Stream/Directives/Directive.php @@ -638,7 +638,7 @@ public function getResolverClass(ResolverProvider $provider, FieldValue $value, } /** - * @return Closure(mixed, array, GraphQLContext, ResolveInfo): EloquentBuilder + * @return Closure(mixed,array,GraphQLContext,ResolveInfo):EloquentBuilder */ protected function getResolverModel(string $model): Closure { $class = $this->namespaceModelClass($model); diff --git a/packages/graphql/src/Stream/Directives/OffsetTest.php b/packages/graphql/src/Stream/Directives/OffsetTest.php index 885d1e13e..e1277905a 100644 --- a/packages/graphql/src/Stream/Directives/OffsetTest.php +++ b/packages/graphql/src/Stream/Directives/OffsetTest.php @@ -65,7 +65,7 @@ public static function dataProviderGetFieldArgumentValue(): array { // // ========================================================================= /** - * @param array $path + * @param list $path */ private static function getResolveInfo(array $path): ResolveInfo { $info = Mockery::mock(ResolveInfo::class); diff --git a/packages/graphql/src/Testing/Package/Data/Models/TestObject.php b/packages/graphql/src/Testing/Package/Data/Models/TestObject.php index 4bdc5c667..41657dbd8 100644 --- a/packages/graphql/src/Testing/Package/Data/Models/TestObject.php +++ b/packages/graphql/src/Testing/Package/Data/Models/TestObject.php @@ -2,7 +2,6 @@ namespace LastDragon_ru\LaraASP\GraphQL\Testing\Package\Data\Models; -use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use LastDragon_ru\LaraASP\Eloquent\Concerns\WithoutTimestamps; @@ -14,6 +13,9 @@ * @property string $value */ class TestObject extends Model { + /** + * @use HasFactory + */ use HasFactory; use WithoutTimestamps; @@ -35,10 +37,7 @@ class TestObject extends Model { */ public $incrementing = false; - /** - * @return Factory - */ - protected static function newFactory(): Factory { + protected static function newFactory(): TestObjectFactory { return TestObjectFactory::new(); } } diff --git a/packages/graphql/src/Testing/Package/Data/Models/TestObjectSearchable.php b/packages/graphql/src/Testing/Package/Data/Models/TestObjectSearchable.php index 2ae268626..59ebd6fcb 100644 --- a/packages/graphql/src/Testing/Package/Data/Models/TestObjectSearchable.php +++ b/packages/graphql/src/Testing/Package/Data/Models/TestObjectSearchable.php @@ -2,7 +2,6 @@ namespace LastDragon_ru\LaraASP\GraphQL\Testing\Package\Data\Models; -use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Laravel\Scout\Searchable; @@ -15,8 +14,11 @@ * @property string $value */ class TestObjectSearchable extends Model { - use Searchable; + /** + * @use HasFactory + */ use HasFactory; + use Searchable; use WithoutTimestamps; /** @@ -37,10 +39,7 @@ class TestObjectSearchable extends Model { */ public $incrementing = false; - /** - * @return Factory - */ - protected static function newFactory(): Factory { + protected static function newFactory(): TestObjectSearchableFactory { return TestObjectSearchableFactory::new(); } } diff --git a/packages/migrator/src/Extenders/SmartMigrator.php b/packages/migrator/src/Extenders/SmartMigrator.php index 1377fc781..f1074f672 100644 --- a/packages/migrator/src/Extenders/SmartMigrator.php +++ b/packages/migrator/src/Extenders/SmartMigrator.php @@ -27,10 +27,8 @@ public static function create(Migrator $migrator): self { // ========================================================================= /** * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint - * + * @inheritDoc * @param array|string $paths - * - * @return array */ #[Override] public function getMigrationFiles($paths): array {