1 | <?php |
||
30 | class SinglePrice extends AbstractPrice |
||
31 | { |
||
32 | /** |
||
33 | * @var Quantity prepaid quantity also implies Unit |
||
34 | */ |
||
35 | protected $prepaid; |
||
36 | |||
37 | /** |
||
38 | * @var Money |
||
39 | */ |
||
40 | protected $price; |
||
41 | |||
42 | 5 | public function __construct( |
|
43 | $id, |
||
44 | TypeInterface $type, |
||
45 | TargetInterface $target, |
||
46 | PlanInterface $plan = null, |
||
47 | QuantityInterface $prepaid, |
||
48 | Money $price |
||
49 | ) { |
||
50 | 5 | parent::__construct($id, $type, $target, $plan); |
|
51 | 5 | $this->prepaid = $prepaid; |
|
|
|||
52 | 5 | $this->price = $price; |
|
53 | 5 | } |
|
54 | |||
55 | 1 | public function getPrepaid() |
|
59 | |||
60 | 1 | public function getPrice() |
|
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 3 | public function calculateUsage(QuantityInterface $quantity): ?QuantityInterface |
|
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | * Same price for any usage. |
||
78 | */ |
||
79 | 2 | public function calculatePrice(QuantityInterface $usage): ?Money |
|
83 | |||
84 | public function jsonSerialize() |
||
91 | } |
||
92 |
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.