diff --git a/composer.json b/composer.json index 80134c1..f1cdafa 100644 --- a/composer.json +++ b/composer.json @@ -21,9 +21,6 @@ "larastan/larastan": "^2.9", "mockery/mockery": "^1.6", "orchestra/testbench": "^9.0", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.4", "phpunit/phpunit": "^11.0", "staudenmeir/eloquent-json-relations": "^1.11", "staudenmeir/laravel-adjacency-list": "^1.21" diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d6fdb67..14e6a85 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,13 +1,9 @@ includes: - ./vendor/larastan/larastan/extension.neon - - ./vendor/phpstan/phpstan-mockery/extension.neon - - ./vendor/phpstan/phpstan-phpunit/extension.neon - - ./vendor/phpstan/phpstan-phpunit/rules.neon parameters: level: 6 paths: - src - - tests treatPhpDocTypesAsCertain: false ignoreErrors: - '#Unsafe usage of new static\(\).#' diff --git a/tests/Concatenation/EloquentJsonRelations/Models/Project.php b/tests/Concatenation/EloquentJsonRelations/Models/Project.php index 952d315..6f90ec5 100644 --- a/tests/Concatenation/EloquentJsonRelations/Models/Project.php +++ b/tests/Concatenation/EloquentJsonRelations/Models/Project.php @@ -6,16 +6,10 @@ use Staudenmeir\EloquentHasManyDeep\HasRelationships; use Staudenmeir\EloquentJsonRelations\JsonKey; -/** - * @property-read \Illuminate\Database\Eloquent\Relations\Pivot $pivot - */ class Project extends Model { use HasRelationships; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Role, $this> - */ public function roles(): HasManyDeep { return $this->hasManyThroughJson( @@ -28,9 +22,6 @@ public function roles(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Role, $this> - */ public function roles2(): HasManyDeep { return $this->hasManyThroughJson( diff --git a/tests/Concatenation/EloquentJsonRelations/Models/Role.php b/tests/Concatenation/EloquentJsonRelations/Models/Role.php index 0bef317..b833d42 100644 --- a/tests/Concatenation/EloquentJsonRelations/Models/Role.php +++ b/tests/Concatenation/EloquentJsonRelations/Models/Role.php @@ -7,32 +7,20 @@ use Staudenmeir\EloquentHasManyDeep\HasRelationships; use Staudenmeir\EloquentJsonRelations\JsonKey; -/** - * @property-read \Illuminate\Database\Eloquent\Relations\Pivot $pivot - */ class Role extends Model { use HasRelationships; - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Concatenation\EloquentJsonRelations\Models\Permission> - */ public function permissions(): HasMany { return $this->hasMany(Permission::class); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Project, $this> - */ public function projects(): HasManyDeep { return $this->hasManyThroughJson(Project::class, User::class, new JsonKey('options->role_ids')); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Project, $this> - */ public function projects2(): HasManyDeep { return $this->hasManyThroughJson(Project::class, User::class, new JsonKey('options->roles[]->role->id')); diff --git a/tests/Concatenation/EloquentJsonRelations/Models/User.php b/tests/Concatenation/EloquentJsonRelations/Models/User.php index dbc42c8..eb2f006 100644 --- a/tests/Concatenation/EloquentJsonRelations/Models/User.php +++ b/tests/Concatenation/EloquentJsonRelations/Models/User.php @@ -14,17 +14,11 @@ class User extends Model 'options' => 'json', ]; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Permission, $this> - */ public function permissions(): HasManyDeep { return $this->hasManyDeepFromRelations($this->roles(), (new Role())->permissions()); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\EloquentJsonRelations\Models\Permission, $this> - */ public function permissions2(): HasManyDeep { return $this->hasManyDeepFromRelations($this->roles2(), (new Role())->permissions()); diff --git a/tests/Concatenation/LaravelAdjacencyList/Models/User.php b/tests/Concatenation/LaravelAdjacencyList/Models/User.php index 29d89a1..8029004 100644 --- a/tests/Concatenation/LaravelAdjacencyList/Models/User.php +++ b/tests/Concatenation/LaravelAdjacencyList/Models/User.php @@ -11,10 +11,6 @@ use Staudenmeir\LaravelAdjacencyList\Eloquent\HasRecursiveRelationships; use Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\HasManyOfDescendants; -/** - * @property-read \Tests\Concatenation\LaravelAdjacencyList\Models\Post $ancestorPost - * @property-read \Tests\Concatenation\LaravelAdjacencyList\Models\Post $descendantPost - */ class User extends Model { use HasRelationships; @@ -22,9 +18,6 @@ class User extends Model use HasTableAlias; use SoftDeletes; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this> - */ public function ancestorPost(): HasOneDeep { return $this->hasOneDeepFromRelations( @@ -33,9 +26,6 @@ public function ancestorPost(): HasOneDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this> - */ public function ancestorPosts(): HasManyDeep { return $this->hasManyDeepFromRelations( @@ -44,9 +34,6 @@ public function ancestorPosts(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this> - */ public function ancestorAndSelfPosts(): HasManyDeep { return $this->hasManyDeepFromRelations( @@ -55,9 +42,6 @@ public function ancestorAndSelfPosts(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this> - */ public function bloodlinePosts(): HasManyDeep { return $this->hasManyDeepFromRelations( @@ -66,9 +50,6 @@ public function bloodlinePosts(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this> - */ public function descendantPost(): HasOneDeep { return $this->hasOneDeepFromRelations( @@ -77,9 +58,6 @@ public function descendantPost(): HasOneDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this> - */ public function descendantPosts(): HasManyDeep { return $this->hasManyDeepFromRelations( @@ -88,9 +66,6 @@ public function descendantPosts(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelAdjacencyList\Models\Post, $this> - */ public function descendantPostsAndSelf(): HasManyDeep { return $this->hasManyDeepFromRelations( @@ -99,9 +74,6 @@ public function descendantPostsAndSelf(): HasManyDeep ); } - /** - * @return \Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\HasManyOfDescendants<\Tests\Concatenation\LaravelAdjacencyList\Models\Post> - */ public function posts(): HasManyOfDescendants { return $this->hasManyOfDescendants(Post::class); diff --git a/tests/Concatenation/LaravelHasManyMerged/Models/Country.php b/tests/Concatenation/LaravelHasManyMerged/Models/Country.php index 85b3842..5824d90 100644 --- a/tests/Concatenation/LaravelHasManyMerged/Models/Country.php +++ b/tests/Concatenation/LaravelHasManyMerged/Models/Country.php @@ -11,9 +11,6 @@ class Country extends Model { use HasRelationships; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelHasManyMerged\Models\Attachment, $this> - */ public function attachments(): HasManyDeep { return $this->hasManyDeepFromRelations( @@ -23,17 +20,11 @@ public function attachments(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelHasManyMerged\Models\Message, $this> - */ public function messages(): HasManyDeep { return $this->hasManyDeepFromRelations($this->users(), (new User())->messages()); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Concatenation\LaravelHasManyMerged\Models\User> - */ public function users(): HasMany { return $this->hasMany(User::class); diff --git a/tests/Concatenation/LaravelHasManyMerged/Models/Message.php b/tests/Concatenation/LaravelHasManyMerged/Models/Message.php index 0fd8db8..64e6dce 100644 --- a/tests/Concatenation/LaravelHasManyMerged/Models/Message.php +++ b/tests/Concatenation/LaravelHasManyMerged/Models/Message.php @@ -7,9 +7,6 @@ class Message extends Model { - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Concatenation\LaravelHasManyMerged\Models\Attachment> - */ public function attachments(): HasMany { return $this->hasMany(Attachment::class); diff --git a/tests/Concatenation/LaravelHasManyMerged/Models/User.php b/tests/Concatenation/LaravelHasManyMerged/Models/User.php index ce8c968..2edea95 100644 --- a/tests/Concatenation/LaravelHasManyMerged/Models/User.php +++ b/tests/Concatenation/LaravelHasManyMerged/Models/User.php @@ -13,17 +13,11 @@ class User extends Model use HasManyMergedRelation; use HasRelationships; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Concatenation\LaravelHasManyMerged\Models\Attachment, $this> - */ public function attachments(): HasManyDeep { return $this->hasManyDeepFromRelations($this->messages(), (new Message())->attachments()); } - /** - * @return \Korridor\LaravelHasManyMerged\HasManyMerged<\Tests\Concatenation\LaravelHasManyMerged\Models\Message> - */ public function messages(): HasManyMerged { return $this->hasManyMerged(Message::class, ['sender_id', 'recipient_id']); diff --git a/tests/HasManyDeepTest.php b/tests/HasManyDeepTest.php index 490d09e..e10ba66 100644 --- a/tests/HasManyDeepTest.php +++ b/tests/HasManyDeepTest.php @@ -161,7 +161,6 @@ public function testExistenceQueryForThroughSelfRelationWithoutAliasTrait(): voi public function testWithTrashed(): void { - /** @var \Tests\Models\User $user */ $user = Comment::find(33)->user() ->withTrashed() ->first(); @@ -182,7 +181,6 @@ public function testWithTrashedIntermediateAndWithCount(): void { $country = Country::withCount('commentsWithTrashedUsers as count')->first(); - // @phpstan-ignore property.notFound $this->assertEquals(3, $country->count); } } diff --git a/tests/IdeHelper/Models/User.php b/tests/IdeHelper/Models/User.php index 5d788c3..ec8e822 100644 --- a/tests/IdeHelper/Models/User.php +++ b/tests/IdeHelper/Models/User.php @@ -11,17 +11,11 @@ class User extends Model { use HasRelationships; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\IdeHelper\Models\Comment, $this> - */ public function comment(): HasOneDeep { return $this->hasOneDeep(Comment::class, [Post::class]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\IdeHelper\Models\Comment, $this> - */ public function comments(): HasManyDeep { return $this->hasManyDeep(Comment::class, [Post::class]); diff --git a/tests/Models/Comment.php b/tests/Models/Comment.php index 3081db7..7de27c7 100644 --- a/tests/Models/Comment.php +++ b/tests/Models/Comment.php @@ -8,20 +8,11 @@ use Staudenmeir\EloquentHasManyDeep\HasOneDeep; use Staudenmeir\EloquentHasManyDeep\HasTableAlias; -/** - * @property-read \Tests\Models\Country|null $country - * @property-read \Tests\Models\Country|null $countryWithCustomThroughTable - * @property-read \Tests\Models\Post|null $post - * @property-read \Tests\Models\Post|null $rootPost - */ class Comment extends Model { use HasTableAlias; use SoftDeletes; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Country, $this> - */ public function country(): HasOneDeep { return $this->hasOneDeepFromReverse( @@ -29,9 +20,6 @@ public function country(): HasOneDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Country, $this> - */ public function countryWithCustomThroughTable(): HasOneDeep { return $this->hasOneDeepFromReverse( @@ -39,17 +27,11 @@ public function countryWithCustomThroughTable(): HasOneDeep ); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\Comment> - */ public function replies(): HasMany { return $this->hasMany(Comment::class, 'parent_id'); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Post, $this> - */ public function rootPost(): HasOneDeep { return $this->hasOneDeepFromReverse( @@ -57,9 +39,6 @@ public function rootPost(): HasOneDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Tag, $this> - */ public function tags(): HasManyDeep { return $this->hasManyDeepFromReverse( @@ -67,9 +46,6 @@ public function tags(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\User, $this> - */ public function user(): HasOneDeep { return $this->hasOneDeep( diff --git a/tests/Models/Country.php b/tests/Models/Country.php index e447657..56fc490 100644 --- a/tests/Models/Country.php +++ b/tests/Models/Country.php @@ -7,59 +7,36 @@ use Staudenmeir\EloquentHasManyDeep\HasManyDeep; use Staudenmeir\EloquentHasManyDeep\HasOneDeep; -/** - * @property-read \Tests\Models\Comment|null $comment - * @property-read \Tests\Models\Comment|null $commentFromRelations - * @property-read \Tests\Models\Comment|null $commentFromRelationsWithConstraints - */ class Country extends Model { - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Comment, $this> - */ public function comment(): HasOneDeep { return $this->hasOneDeep(Comment::class, [User::class, Post::class])->withDefault(); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Comment, $this> - */ public function commentFromRelations(): HasOneDeep { return $this->hasOneDeepFromRelations($this->posts(), (new Post())->comments()); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasOneDeep<\Tests\Models\Comment, $this> - */ public function commentFromRelationsWithConstraints(): HasOneDeep { return $this->hasOneDeepFromRelationsWithConstraints( [$this, 'postsWithConstraints'], [new Post(), 'comments'] - )->orderByDesc('comments.id'); // TODO + )->orderByDesc('comments.id'); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function comments(): HasManyDeep { return $this->hasManyDeep(Comment::class, [User::class, Post::class]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations([$this->posts(), (new Post())->comments()]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelationsWithConstraints(): HasManyDeep { return $this->hasManyDeepFromRelationsWithConstraints( @@ -67,9 +44,6 @@ public function commentsFromRelationsWithConstraints(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelationsWithTrashedFinalRelatedModel(): HasManyDeep { return $this->hasManyDeepFromRelationsWithConstraints( @@ -77,17 +51,11 @@ public function commentsFromRelationsWithTrashedFinalRelatedModel(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelationsWithTrashedIntermediateDeepModel(): HasManyDeep { return $this->hasManyDeepFromRelationsWithConstraints([$this, 'commentsWithTrashedUsers']); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelationsWithTrashedIntermediateRelatedModel(): HasManyDeep { return $this->hasManyDeepFromRelationsWithConstraints( @@ -95,9 +63,6 @@ public function commentsFromRelationsWithTrashedIntermediateRelatedModel(): HasM ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelationsWithTrashedParents(): HasManyDeep { return $this->hasManyDeepFromRelationsWithConstraints( @@ -105,9 +70,6 @@ public function commentsFromRelationsWithTrashedParents(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelationsWithCustomRelatedTable(): HasManyDeep { $comment = (new Comment())->setTable('my_comments'); @@ -122,9 +84,6 @@ public function commentsFromRelationsWithCustomRelatedTable(): HasManyDeep return $this->hasManyDeepFromRelations([$this->posts(), $comments]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelationsWithCustomThroughTable(): HasManyDeep { $user = (new User())->setTable('my_users'); @@ -139,81 +98,51 @@ public function commentsFromRelationsWithCustomThroughTable(): HasManyDeep return $this->hasManyDeepFromRelations([$users, (new User())->comments()]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsWithTrashedUsers(): HasManyDeep { return $this->comments()->withTrashed('users.deleted_at'); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Permission, $this> - */ public function permissions(): HasManyDeep { return $this->hasManyDeep(Permission::class, [User::class, 'role_user', Role::class]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Permission, $this> - */ public function permissionsFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->permissions()); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Permission, $this> - */ public function permissionsWithPivotAlias(): HasManyDeep { return $this->hasManyDeep(Permission::class, [User::class, RoleUser::class.' as alias', Role::class]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Permission, $this> - */ public function permissionsWithPivotAliasFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->permissionsWithPivotAlias()); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Tests\Models\Post> - */ public function posts(): HasManyThrough { return $this->hasManyThrough(Post::class, User::class); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Tests\Models\Post> - */ public function postsWithConstraints(): HasManyThrough { return $this->posts()->where('posts.published', true); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Tests\Models\Post> - */ public function postsWithTrashedParents(): HasManyThrough { return $this->posts()->withTrashedParents(); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Role, $this> - */ public function roles(): HasManyDeep { return $this->hasManyDeep(Role::class, [User::class, 'role_user']); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\User> - */ public function usersWithTrashed(): HasMany { return $this->hasMany(User::class)->withTrashed(); diff --git a/tests/Models/Employee.php b/tests/Models/Employee.php index 9eae5ab..669a014 100644 --- a/tests/Models/Employee.php +++ b/tests/Models/Employee.php @@ -13,9 +13,6 @@ class Employee extends Model use Compoships; use HasRelationships; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Project, $this> - */ public function projects(): HasManyDeep { return $this->hasManyDeep( @@ -26,17 +23,11 @@ public function projects(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Project, $this> - */ public function projectsFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->tasks(), (new Task())->project()); } - /** - * @return \Awobaz\Compoships\Database\Eloquent\Relations\HasMany<\Tests\Models\Task> - */ public function tasks(): HasMany { return $this->hasMany(Task::class, ['team_id', 'work_stream_id'], ['team_id', 'work_stream_id']); diff --git a/tests/Models/Like.php b/tests/Models/Like.php index 1aff805..5c5e2c0 100644 --- a/tests/Models/Like.php +++ b/tests/Models/Like.php @@ -6,9 +6,6 @@ class Like extends Model { - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Tests\Models\User, self> - */ public function user(): BelongsTo { return $this->belongsTo(User::class); diff --git a/tests/Models/Permission.php b/tests/Models/Permission.php index 0ecbcaf..3cdd7a9 100644 --- a/tests/Models/Permission.php +++ b/tests/Models/Permission.php @@ -5,17 +5,10 @@ use Staudenmeir\EloquentHasManyDeep\HasManyDeep; use Staudenmeir\EloquentHasManyDeep\HasRelationships; -/** - * @property-read \Illuminate\Database\Eloquent\Relations\Pivot $pivot - * @property-read \Illuminate\Database\Eloquent\Relations\Pivot $role_user - */ class Permission extends Model { use HasRelationships; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Country, $this> - */ public function countries(): HasManyDeep { return $this->hasManyDeepFromReverse( diff --git a/tests/Models/Post.php b/tests/Models/Post.php index 96cfab1..c7002d9 100644 --- a/tests/Models/Post.php +++ b/tests/Models/Post.php @@ -7,22 +7,13 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany; use Staudenmeir\EloquentHasManyDeep\HasManyDeep; -/** - * @property-read \Tests\Models\User|null $user - */ class Post extends Model { - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\Comment> - */ public function comments(): HasMany { return $this->hasMany(Comment::class); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentReplies(): HasManyDeep { return $this->hasManyDeep( @@ -32,9 +23,6 @@ public function commentReplies(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentRepliesFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations( @@ -43,25 +31,16 @@ public function commentRepliesFromRelations(): HasManyDeep ); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\Comment> - */ public function commentsWithTrashed(): HasMany { return $this->hasMany(Comment::class)->withTrashed(); } - /** - * @return \Illuminate\Database\Eloquent\Relations\MorphMany<\Tests\Models\Like> - */ public function likes(): MorphMany { return $this->morphMany(Like::class, 'likeable'); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function nestedCommentReplies(): HasManyDeep { return $this->hasManyDeep( @@ -71,9 +50,6 @@ public function nestedCommentReplies(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Post, $this> - */ public function posts(): HasManyDeep { return $this->hasManyDeep( @@ -84,17 +60,11 @@ public function posts(): HasManyDeep ); } - /** - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany<\Tests\Models\Tag> - */ public function tags(): MorphToMany { return $this->morphToMany(Tag::class, 'taggable'); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\User, $this> - */ public function users(): HasManyDeep { return $this->hasManyDeep( @@ -105,9 +75,6 @@ public function users(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\User, $this> - */ public function usersFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->likes(), (new Like())->user()); diff --git a/tests/Models/Project.php b/tests/Models/Project.php index d9a441c..95a8d52 100644 --- a/tests/Models/Project.php +++ b/tests/Models/Project.php @@ -11,9 +11,6 @@ class Project extends Model { use HasRelationships; - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Employee, $this> - */ public function employees(): HasManyDeep { return $this->hasManyDeep( @@ -24,17 +21,11 @@ public function employees(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Employee, $this> - */ public function employeesFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->tasks(), (new Task())->employee()); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\Task> - */ public function tasks(): HasMany { return $this->hasMany(Task::class); diff --git a/tests/Models/Role.php b/tests/Models/Role.php index ed99920..34f6cd9 100644 --- a/tests/Models/Role.php +++ b/tests/Models/Role.php @@ -6,9 +6,6 @@ class Role extends Model { - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\Permission> - */ public function permissions(): HasMany { return $this->hasMany(Permission::class); diff --git a/tests/Models/Tag.php b/tests/Models/Tag.php index a2bbd81..be63149 100644 --- a/tests/Models/Tag.php +++ b/tests/Models/Tag.php @@ -7,9 +7,6 @@ class Tag extends Model { - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function comments(): HasManyDeep { return $this->hasManyDeep( @@ -20,17 +17,11 @@ public function comments(): HasManyDeep ); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Comment, $this> - */ public function commentsFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->posts(), (new Post())->comments()); } - /** - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany<\Tests\Models\Post> - */ public function posts(): MorphToMany { return $this->morphedByMany(Post::class, 'taggable'); diff --git a/tests/Models/Task.php b/tests/Models/Task.php index 7dcc282..6ea85a7 100644 --- a/tests/Models/Task.php +++ b/tests/Models/Task.php @@ -10,17 +10,11 @@ class Task extends Model { use Compoships; - /** - * @return \Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo<\Tests\Models\Employee, self> - */ public function employee(): ComposhipsBelongsTo { return $this->belongsTo(Employee::class, ['team_id', 'work_stream_id'], ['team_id', 'work_stream_id']); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Tests\Models\Project, self> - */ public function project(): BelongsTo { return $this->belongsTo(Project::class); diff --git a/tests/Models/User.php b/tests/Models/User.php index 947a1df..fb93c36 100644 --- a/tests/Models/User.php +++ b/tests/Models/User.php @@ -13,81 +13,51 @@ class User extends Model { use SoftDeletes; - /** - * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough<\Tests\Models\Comment> - */ public function comment(): HasOneThrough { return $this->hasOneThrough(Comment::class, Post::class); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Tests\Models\Comment> - */ public function comments(): HasManyThrough { return $this->hasManyThrough(Comment::class, Post::class); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Like, $this> - */ public function likes(): HasManyDeep { return $this->hasManyDeep(Like::class, [Post::class], [null, ['likeable_type', 'likeable_id']]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Permission, $this> - */ public function permissions(): HasManyDeep { return $this->hasManyDeep(Permission::class, ['role_user', Role::class]); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Permission, $this> - */ public function permissionsFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->roles(), (new Role())->permissions()); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\User, $this> - */ public function players(): HasManyDeep { return $this->hasManyDeep(User::class, [Club::class, Team::class]); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany<\Tests\Models\Post> - */ public function posts(): HasMany { return $this->hasMany(Post::class); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<\Tests\Models\Role> - */ public function roles(): BelongsToMany { return $this->belongsToMany(Role::class); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Tag, $this> - */ public function tagsFromRelations(): HasManyDeep { return $this->hasManyDeepFromRelations($this->posts(), (new Post())->tags()); } - /** - * @return \Staudenmeir\EloquentHasManyDeep\HasManyDeep<\Tests\Models\Post, $this> - */ public function teamPosts(): HasManyDeep { return $this->hasManyDeep(