1 | <?php |
||
18 | final class CartItem implements CreatableFromArray |
||
19 | { |
||
20 | /** |
||
21 | * @var int |
||
22 | */ |
||
23 | private $id; |
||
24 | |||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | private $quantity; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | private $unitPrice; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | private $total; |
||
39 | |||
40 | /** |
||
41 | * @var Variant |
||
42 | */ |
||
43 | private $variant; |
||
44 | |||
45 | /** |
||
46 | * CartItem constructor. |
||
47 | * |
||
48 | * @param Variant|null $variant |
||
49 | */ |
||
50 | private function __construct( |
||
65 | |||
66 | /** |
||
67 | * @return CartItem |
||
68 | */ |
||
69 | public static function createFromArray(array $data): self |
||
98 | |||
99 | public function getId(): int |
||
103 | |||
104 | public function getQuantity(): int |
||
108 | |||
109 | public function getUnitPrice(): int |
||
113 | |||
114 | public function getTotal(): int |
||
118 | |||
119 | public function getVariant(): ?Variant |
||
123 | } |
||
124 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.