| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 51 | public function getIterator() |
||
| 52 | { |
||
| 53 | /** @var Builder|\Illuminate\Database\Query\Builder|Model $query */ |
||
| 54 | $query = clone $this->builder; |
||
| 55 | |||
| 56 | $skip = 0; |
||
| 57 | $count = $query->count(); |
||
|
|
|||
| 58 | do { |
||
| 59 | $items = $query->skip($skip)->take($this->chunk)->get(); |
||
| 60 | foreach ($items as $item) { |
||
| 61 | yield $item; |
||
| 62 | } |
||
| 63 | $skip += $this->chunk; |
||
| 64 | } while ($skip < $count + $this->chunk); |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
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: