Skip to content

Commit b1008af

Browse files
authored
use "class-string" where appropriate in relations (#55074)
we'll use the more accurate "class-string" type for "morphClass" references. also specify the generic type where appropriate
1 parent 8a0625d commit b1008af

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ abstract class MorphOneOrMany extends HasOneOrMany
2525
/**
2626
* The class name of the parent model.
2727
*
28-
* @var string
28+
* @var class-string<TRelatedModel>
2929
*/
3030
protected $morphClass;
3131

@@ -159,7 +159,7 @@ public function getMorphType()
159159
/**
160160
* Get the class name of the parent model.
161161
*
162-
* @return string
162+
* @return class-string<TRelatedModel>
163163
*/
164164
public function getMorphClass()
165165
{

src/Illuminate/Database/Eloquent/Relations/MorphPivot.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MorphPivot extends Pivot
1818
*
1919
* Explicitly define this so it's not included in saved attributes.
2020
*
21-
* @var string
21+
* @var class-string
2222
*/
2323
protected $morphClass;
2424

@@ -100,7 +100,7 @@ public function setMorphType($morphType)
100100
/**
101101
* Set the morph class for the pivot.
102102
*
103-
* @param string $morphClass
103+
* @param class-string $morphClass
104104
* @return \Illuminate\Database\Eloquent\Relations\MorphPivot
105105
*/
106106
public function setMorphClass($morphClass)

src/Illuminate/Database/Eloquent/Relations/MorphToMany.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MorphToMany extends BelongsToMany
2525
/**
2626
* The class name of the morph type constraint.
2727
*
28-
* @var string
28+
* @var class-string<TRelatedModel>
2929
*/
3030
protected $morphClass;
3131

@@ -212,7 +212,7 @@ public function getQualifiedMorphTypeName()
212212
/**
213213
* Get the class name of the parent model.
214214
*
215-
* @return string
215+
* @return class-string<TRelatedModel>
216216
*/
217217
public function getMorphClass()
218218
{

0 commit comments

Comments
 (0)