Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.1406 |
Changes | 0 |
1 | <?php |
||
70 | 1 | public function calculateSum(QuantityInterface $quantity) |
|
71 | { |
||
72 | 1 | $usage = $this->calculateUsage($quantity); |
|
73 | 1 | if ($usage === null) { |
|
74 | return null; |
||
75 | } |
||
76 | |||
77 | 1 | $price = $this->calculatePrice($quantity); |
|
78 | 1 | if ($price === null) { |
|
79 | return null; |
||
80 | } |
||
81 | |||
82 | 1 | return $price->multiply($usage->getQuantity()); |
|
83 | } |
||
84 | |||
100 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.