class Translations extends Model
{
/**
* @return MorphTo<Model, \App\Models\Translations\Translations>
*/
public function translatable(): MorphTo
{
return $this->morphTo('translatable', 'model', 'value');
}
}
The rule changes it to the following:
class Translations extends Model
{
/**
* @return MorphTo<\translatable, \App\Models\Translations\Translations>
*/
public function translatable(): MorphTo
{
return $this->morphTo('translatable', 'model', 'value');
}
}
Which in return gives problems with Larastan. This is because it is returned by the function getRelatedModelClassFromMethodCall. I can fix it rewriting it to the following (but I guess this breaks other stuff?):
Given the following code (with correct generics):
The rule changes it to the following:
Which in return gives problems with Larastan. This is because it is returned by the function
getRelatedModelClassFromMethodCall
. I can fix it rewriting it to the following (but I guess this breaks other stuff?):What should be the correct fix for this problem? Maybe add a check if the given relation is a
morphTo
?