| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.4746 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 35 | 1 | protected function getWebsite(string $package) |
|
| 36 | { |
||
| 37 | 1 | $package = package($package); |
|
| 38 | 1 | $homepage = $package->getConfig('homepage'); |
|
|
|
|||
| 39 | |||
| 40 | 1 | if ($homepage === null) { |
|
| 41 | 1 | return ''; |
|
| 42 | } |
||
| 43 | |||
| 44 | if (filter_var($homepage, FILTER_VALIDATE_URL) === false) { |
||
| 45 | return ''; |
||
| 46 | } |
||
| 47 | |||
| 48 | return ' (' . $homepage . ') '; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: