Conditions | 2 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
40 | public function getFileContents(Project $project, string $file): array |
||
41 | { |
||
42 | try { |
||
43 | $fileContent = $this->client->api('repositories')->getFile( |
||
|
|||
44 | $project->getVendorName() . '/' . $project->getPackageName(), |
||
45 | $file, |
||
46 | $project->getBranch() |
||
47 | ); |
||
48 | |||
49 | return $this->parseJson($fileContent); |
||
50 | } catch (\Gitlab\Exception\RuntimeException $e) { |
||
51 | return []; |
||
52 | } |
||
53 | } |
||
54 | |||
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: