1 | <?php |
||
18 | class MorphTo extends BelongsTo |
||
19 | { |
||
20 | use HasMorphTypeTrait; |
||
21 | |||
22 | /** @noinspection PhpMissingParentCallCommonInspection |
||
23 | * @return string |
||
24 | * @throws ModelNotLoadedInRelation |
||
25 | */ |
||
26 | 3 | public function getWithClass() |
|
32 | |||
33 | /** |
||
34 | * @return mixed |
||
35 | * @throws ModelNotLoadedInRelation |
||
36 | */ |
||
37 | 3 | public function getMorphType() |
|
46 | |||
47 | /** |
||
48 | * @param $params |
||
49 | * @throws Exception |
||
50 | */ |
||
51 | 1 | public function addParams($params) |
|
56 | |||
57 | /** |
||
58 | * @inheritdoc |
||
59 | */ |
||
60 | public function getEagerResults($collection) |
||
78 | |||
79 | /** |
||
80 | * @param Collection $collection |
||
81 | * @param $manager |
||
82 | * @return Query |
||
83 | * @throws Exception |
||
84 | */ |
||
85 | 1 | public function getEagerQueryType(Collection $collection, $manager) |
|
92 | |||
93 | /** |
||
94 | * @param Query $query |
||
95 | * @param array $fkList |
||
96 | * @return Query |
||
97 | * @throws Exception |
||
98 | */ |
||
99 | protected function populateEagerQueryFromFkList($query, $fkList) |
||
104 | |||
105 | /** |
||
106 | * @param $collection |
||
107 | * @return array |
||
108 | */ |
||
109 | public function getTypesFromCollection($collection) |
||
117 | } |
||
118 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.