Skip to content

Commit

Permalink
[5.4] Null Morph Map ErrorException (#18921)
Browse files Browse the repository at this point in the history
* [5.4] Null Morph Map ErrorException

Currently, if you call `getActualClassNameForMorph` without the morph map set, it will through an error because `Relation::morphMap()` returns `null` instead of (what I would expect) `[]`.

Is this expected behaviour? If so, why is this expected behaviour?

* Create HasRelationships.php
  • Loading branch information
ConnorVG authored and taylorotwell committed Apr 24, 2017
1 parent f3a6039 commit ab05609
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ protected function morphInstanceTo($target, $name, $type, $id)
*/
public static function getActualClassNameForMorph($class)
{
return Arr::get(Relation::morphMap(), $class, $class);
return Arr::get(Relation::morphMap() ?: [], $class, $class);
}

/**
Expand Down

0 comments on commit ab05609

Please sign in to comment.