Skip to content

Commit 8904daf

Browse files
authored
[11.x] Improve docblocks for morph maps in Relation (#54560)
* add docblocks * more generics * Update Relation.php
1 parent 245e3e7 commit 8904daf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ abstract class Relation implements BuilderContract
6363
protected static $constraints = true;
6464

6565
/**
66-
* An array to map class names to their morph names in the database.
66+
* An array to map morph names to their class names in the database.
6767
*
68-
* @var array
68+
* @var array<string, class-string<\Illuminate\Database\Eloquent\Model>>
6969
*/
7070
public static $morphMap = [];
7171

@@ -451,7 +451,7 @@ public static function requiresMorphMap()
451451
/**
452452
* Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped.
453453
*
454-
* @param array $map
454+
* @param array<string, class-string<\Illuminate\Database\Eloquent\Model>> $map
455455
* @param bool $merge
456456
* @return array
457457
*/
@@ -465,9 +465,9 @@ public static function enforceMorphMap(array $map, $merge = true)
465465
/**
466466
* Set or get the morph map for polymorphic relations.
467467
*
468-
* @param array|null $map
468+
* @param array<string, class-string<\Illuminate\Database\Eloquent\Model>>|null $map
469469
* @param bool $merge
470-
* @return array
470+
* @return array<string, class-string<\Illuminate\Database\Eloquent\Model>>
471471
*/
472472
public static function morphMap(?array $map = null, $merge = true)
473473
{
@@ -484,8 +484,8 @@ public static function morphMap(?array $map = null, $merge = true)
484484
/**
485485
* Builds a table-keyed array from model class names.
486486
*
487-
* @param string[]|null $models
488-
* @return array|null
487+
* @param list<class-string<\Illuminate\Database\Eloquent\Model>>|null $models
488+
* @return array<string, class-string<\Illuminate\Database\Eloquent\Model>>|null
489489
*/
490490
protected static function buildMorphMapFromModels(?array $models = null)
491491
{
@@ -502,7 +502,7 @@ protected static function buildMorphMapFromModels(?array $models = null)
502502
* Get the model associated with a custom polymorphic type.
503503
*
504504
* @param string $alias
505-
* @return string|null
505+
* @return class-string<\Illuminate\Database\Eloquent\Model>|null
506506
*/
507507
public static function getMorphedModel($alias)
508508
{
@@ -512,7 +512,7 @@ public static function getMorphedModel($alias)
512512
/**
513513
* Get the alias associated with a custom polymorphic class.
514514
*
515-
* @param string $className
515+
* @param class-string<\Illuminate\Database\Eloquent\Model> $className
516516
* @return int|string
517517
*/
518518
public static function getMorphAlias(string $className)

0 commit comments

Comments
 (0)