Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
62 | private function parseJson($data) |
||
63 | { |
||
64 | if ($data === false) { |
||
65 | throw new \RuntimeException('Unable to parse json file'); |
||
66 | } |
||
67 | |||
68 | if (array_key_exists('content', $data)) { |
||
69 | return json_decode(base64_decode($data['content']), true); |
||
70 | } |
||
71 | |||
72 | return ''; |
||
73 | } |
||
74 | } |
||
75 |
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: