Conditions | 3 |
Paths | 4 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
35 | public function getPrepaidQuantity() |
||
36 | { |
||
37 | if ($this->getCpuUnit() === self::UNIT_CORE) { |
||
38 | preg_match('/((\d+) cores?)$/i', $this->resource->part->partno, $matches); |
||
39 | } else { |
||
40 | preg_match('/((\d+) MHz)$/i', $this->resource->part->partno, $matches); |
||
41 | } |
||
42 | |||
43 | return $matches[2] === null ? 0 : $matches[2]; |
||
44 | } |
||
45 | |||
55 |
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: