1 | <?php |
||
7 | class Volumes |
||
8 | { |
||
9 | protected $client; |
||
10 | |||
11 | public function __construct(GoogleBooks $client) |
||
15 | |||
16 | /** |
||
17 | * @param $query |
||
18 | * @return stdclass | array |
||
19 | */ |
||
20 | public function search($query) |
||
24 | |||
25 | /** |
||
26 | * @param $query |
||
27 | * @return array |
||
28 | */ |
||
29 | public function fetchSearch($query) |
||
38 | |||
39 | public function firstOrNull($query) |
||
43 | |||
44 | public function find($id) |
||
48 | |||
49 | public function byIsbn($isbn) |
||
54 | } |
||
55 |
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.