-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Fix return types of firstWhere
and first
of BelongsToMany
and HasManyThrough
#51219
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -784,7 +784,7 @@ public function findOr($id, $columns = ['*'], ?Closure $callback = null) | |||||
* @param mixed $operator | ||||||
* @param mixed $value | ||||||
* @param string $boolean | ||||||
* @return \Illuminate\Database\Eloquent\Model|static | ||||||
* @return \Illuminate\Database\Eloquent\Model|static|null | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Unless I'm mistaken, this should be correct |
||||||
*/ | ||||||
public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') | ||||||
{ | ||||||
|
@@ -795,7 +795,7 @@ public function firstWhere($column, $operator = null, $value = null, $boolean = | |||||
* Execute the query and get the first result. | ||||||
* | ||||||
* @param array $columns | ||||||
* @return mixed | ||||||
* @return \Illuminate\Database\Eloquent\Model|static|null | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
*/ | ||||||
public function first($columns = ['*']) | ||||||
{ | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -320,7 +320,7 @@ public function updateOrCreate(array $attributes, array $values = []) | |||||
* @param mixed $operator | ||||||
* @param mixed $value | ||||||
* @param string $boolean | ||||||
* @return \Illuminate\Database\Eloquent\Model|static | ||||||
* @return \Illuminate\Database\Eloquent\Model|static|null | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
*/ | ||||||
public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') | ||||||
{ | ||||||
|
@@ -331,7 +331,7 @@ public function firstWhere($column, $operator = null, $value = null, $boolean = | |||||
* Execute the query and get the first related model. | ||||||
* | ||||||
* @param array $columns | ||||||
* @return mixed | ||||||
* @return \Illuminate\Database\Eloquent\Model|static|null | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Updated! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @driesvints can you confirm in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd just leave things be for now. Thanks |
||||||
*/ | ||||||
public function first($columns = ['*']) | ||||||
{ | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also not sure why this returns
|static
, in which case does it return an instance ofBelongsToMany
?