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

[11.x] Make methods of HasRelationships generic #54174

Merged
Merged
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
18 changes: 12 additions & 6 deletions src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ trait HasRelationships
/**
* Get the dynamic relation resolver if defined or inherited, or return null.
*
* @param string $class
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*
* @param class-string<TRelatedModel> $class
* @param string $key
* @return mixed
* @return Closure|null
*/
public function relationResolver($class, $key)
{
Expand Down Expand Up @@ -851,8 +853,10 @@ public function getMorphClass()
/**
* Create a new model instance for a related model.
*
* @param string $class
* @return mixed
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*
* @param class-string<TRelatedModel> $class
* @return TRelatedModel
*/
protected function newRelatedInstance($class)
{
Expand All @@ -866,8 +870,10 @@ protected function newRelatedInstance($class)
/**
* Create a new model instance for a related "through" model.
*
* @param string $class
* @return mixed
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*
* @param class-string<TRelatedModel> $class
* @return TRelatedModel
*/
protected function newRelatedThroughInstance($class)
{
Expand Down
Loading