| 1 | <?php |
||
| 21 | abstract class AbstractPrice implements PriceInterface |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @var integer |
||
| 25 | */ |
||
| 26 | protected $id; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var Plan |
||
| 30 | */ |
||
| 31 | protected $plan; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var Target |
||
| 35 | */ |
||
| 36 | protected $target; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var Type |
||
| 40 | */ |
||
| 41 | protected $type; |
||
| 42 | |||
| 43 | 3 | public function __construct($id, TargetInterface $target, TypeInterface $type) |
|
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | 2 | */ |
|
| 53 | public function getTarget() |
||
| 57 | |||
| 58 | /** |
||
| 59 | * {@inheritdoc} |
||
| 60 | 2 | */ |
|
| 61 | public function getType() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * {@inheritdoc} |
||
| 68 | * Default sum calculation method: sum = price * usage. |
||
| 69 | 1 | */ |
|
| 70 | public function calculateSum(QuantityInterface $quantity) |
||
| 84 | |||
| 85 | public static function create(array $data) |
||
| 89 | |||
| 90 | /** |
||
| 91 | * {@inheritdoc} |
||
| 92 | */ |
||
| 93 | abstract public function calculateUsage(QuantityInterface $quantity); |
||
| 94 | |||
| 95 | /** |
||
| 96 | * {@inheritdoc} |
||
| 97 | */ |
||
| 98 | abstract public function calculatePrice(QuantityInterface $action); |
||
| 99 | } |
||
| 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.