| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function imported($docIndex, $docId) |
||
| 42 | { |
||
| 43 | $doc = Document::with('subjects', 'genres', 'cover')->find($docId); |
||
|
|
|||
| 44 | |||
| 45 | if (!$this->collection->documents->contains($doc->id)) { |
||
| 46 | $this->collection->documents()->attach($doc->id); |
||
| 47 | } |
||
| 48 | |||
| 49 | // Add/update ElasticSearch |
||
| 50 | $docIndex->index($doc); |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: