1 | <?php |
||
11 | class PlanParser |
||
12 | { |
||
13 | /** |
||
14 | * @var Dom |
||
15 | */ |
||
16 | private $parser; |
||
17 | |||
18 | /** |
||
19 | * @var HeaderParser |
||
20 | */ |
||
21 | private $headerParser; |
||
22 | |||
23 | /** |
||
24 | * CpParser constructor. |
||
25 | * |
||
26 | * @param Dom $parser |
||
27 | * @param HeaderParser $headerParser |
||
28 | */ |
||
29 | 1 | public function __construct(Dom $parser, HeaderParser $headerParser) |
|
34 | |||
35 | /** |
||
36 | * @param string $url |
||
37 | * |
||
38 | * @return string |
||
39 | * @throws \Exception |
||
40 | */ |
||
41 | 1 | public function parseToJson($url) |
|
68 | |||
69 | /** |
||
70 | * @param string $url |
||
71 | * |
||
72 | * @return string |
||
73 | * @throws \Exception |
||
74 | */ |
||
75 | public function parseToHtml($url) |
||
84 | |||
85 | /** |
||
86 | * @return array |
||
87 | */ |
||
88 | 1 | private function getPlan() |
|
99 | |||
100 | /** |
||
101 | * @param string $url |
||
102 | * |
||
103 | * @throws \Exception |
||
104 | */ |
||
105 | 1 | private function generateBadRequestException($url) |
|
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.