1 | <?php |
||
7 | class Volumes |
||
8 | { |
||
9 | protected $client; |
||
10 | protected $chunk = false; |
||
11 | |||
12 | public function __construct(GoogleBooks $client) |
||
16 | |||
17 | /** |
||
18 | * @param $query |
||
19 | * @return \Generator|Volume || array |
||
20 | */ |
||
21 | public function search($query) |
||
25 | |||
26 | /** |
||
27 | * @param $query |
||
28 | * @return \Generator|Volume |
||
29 | */ |
||
30 | public function fetchSearch($query) |
||
39 | |||
40 | public function firstOrNull($query) |
||
44 | |||
45 | public function find($id) |
||
49 | |||
50 | public function byIsbn($isbn) |
||
55 | } |
||
56 |
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.