Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update type hints in model docblocks to use $this instead of covariant $this #766

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Models/Bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class Bookmark extends Model
/**
* The question that the bookmark belongs to.
*
* @return BelongsTo<Question, covariant $this>
* @return BelongsTo<Question, $this>
*/
public function question(): BelongsTo
{
Expand All @@ -37,7 +37,7 @@ public function question(): BelongsTo
/**
* The user that the bookmark belongs to.
*
* @return BelongsTo<User, covariant $this>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Hashtag.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function casts(): array
}

/**
* @return BelongsToMany<Question, covariant $this>
* @return BelongsToMany<Question, $this>
*/
public function questions(): BelongsToMany
{
Expand Down
4 changes: 2 additions & 2 deletions app/Models/Like.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class Like extends Model
/**
* The question that the like belongs to.
*
* @return BelongsTo<Question, covariant $this>
* @return BelongsTo<Question, $this>
*/
public function question(): BelongsTo
{
Expand All @@ -37,7 +37,7 @@ public function question(): BelongsTo
/**
* The user that the like belongs to.
*
* @return BelongsTo<User, covariant $this>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class Link extends Model
/**
* Get the user that owns the link.
*
* @return BelongsTo<User, covariant $this>
* @return BelongsTo<User, $this>
*/
public function user(): BelongsTo
{
Expand Down
18 changes: 9 additions & 9 deletions app/Models/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function casts(): array
/**
* Get the user that the question was sent from.
*
* @return BelongsTo<User, covariant $this>
* @return BelongsTo<User, $this>
*/
public function from(): BelongsTo
{
Expand All @@ -154,7 +154,7 @@ public function from(): BelongsTo
/**
* Get the user that the question was sent to.
*
* @return BelongsTo<User, covariant $this>
* @return BelongsTo<User, $this>
*/
public function to(): BelongsTo
{
Expand All @@ -164,7 +164,7 @@ public function to(): BelongsTo
/**
* Get the bookmarks for the question.
*
* @return HasMany<Bookmark, covariant $this>
* @return HasMany<Bookmark, $this>
*/
public function bookmarks(): HasMany
{
Expand All @@ -174,7 +174,7 @@ public function bookmarks(): HasMany
/**
* Get the likes for the question.
*
* @return HasMany<Like, covariant $this>
* @return HasMany<Like, $this>
*/
public function likes(): HasMany
{
Expand Down Expand Up @@ -212,7 +212,7 @@ public function isSharedUpdate(): bool
}

/**
* @return BelongsTo<Question, covariant $this>
* @return BelongsTo<Question, $this>
*/
public function root(): BelongsTo
{
Expand All @@ -222,7 +222,7 @@ public function root(): BelongsTo
}

/**
* @return BelongsTo<Question, covariant $this>
* @return BelongsTo<Question, $this>
*/
public function parent(): BelongsTo
{
Expand All @@ -232,7 +232,7 @@ public function parent(): BelongsTo
}

/**
* @return HasMany<Question, covariant $this>
* @return HasMany<Question, $this>
*/
public function children(): HasMany
{
Expand All @@ -242,7 +242,7 @@ public function children(): HasMany
}

/**
* @return HasMany<Question, covariant $this>
* @return HasMany<Question, $this>
*/
public function descendants(): HasMany
{
Expand All @@ -252,7 +252,7 @@ public function descendants(): HasMany
}

/**
* @return BelongsToMany<Hashtag, covariant $this>
* @return BelongsToMany<Hashtag, $this>
*/
public function hashtags(): BelongsToMany
{
Expand Down
14 changes: 7 additions & 7 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function canAccessPanel(Panel $panel): bool
/**
* Get the user's bookmarks.
*
* @return HasMany<Bookmark, covariant $this>
* @return HasMany<Bookmark, $this>
*/
public function bookmarks(): HasMany
{
Expand All @@ -110,7 +110,7 @@ public function bookmarks(): HasMany
/**
* Get the user's links.
*
* @return HasMany<Link, covariant $this>
* @return HasMany<Link, $this>
*/
public function links(): HasMany
{
Expand All @@ -120,7 +120,7 @@ public function links(): HasMany
/**
* Get the user's questions sent.
*
* @return HasMany<Question, covariant $this>
* @return HasMany<Question, $this>
*/
public function questionsSent(): HasMany
{
Expand All @@ -130,15 +130,15 @@ public function questionsSent(): HasMany
/**
* Get the user's questions received.
*
* @return HasMany<Question, covariant $this>
* @return HasMany<Question, $this>
*/
public function questionsReceived(): HasMany
{
return $this->hasMany(Question::class, 'to_id');
}

/**
* @return HasOne<Question, covariant $this>
* @return HasOne<Question, $this>
*/
public function pinnedQuestion(): HasOne
{
Expand All @@ -149,7 +149,7 @@ public function pinnedQuestion(): HasOne
/**
* Get the user's followers.
*
* @return BelongsToMany<User, covariant $this>
* @return BelongsToMany<User, $this>
*/
public function followers(): BelongsToMany
{
Expand All @@ -159,7 +159,7 @@ public function followers(): BelongsToMany
/**
* Get the user's following.
*
* @return BelongsToMany<User, covariant $this>
* @return BelongsToMany<User, $this>
*/
public function following(): BelongsToMany
{
Expand Down