1 | <?php |
||
25 | class Plan implements PlanInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $id; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $name; |
||
36 | |||
37 | /** |
||
38 | * @var Plan|null |
||
39 | * XXX not sure to implement |
||
40 | */ |
||
41 | protected $parent; |
||
42 | |||
43 | /** |
||
44 | * @var CustomerInterface |
||
45 | */ |
||
46 | protected $seller; |
||
47 | |||
48 | /** |
||
49 | * @var PriceInterface[] |
||
50 | */ |
||
51 | protected $prices; |
||
52 | |||
53 | /** |
||
54 | * @param int $id |
||
55 | * @param string $name |
||
56 | * @param CustomerInterface|null $seller |
||
57 | * @param PriceInterface[] $prices |
||
58 | 1 | */ |
|
59 | public function __construct( |
||
70 | |||
71 | public function getUniqueId() |
||
75 | |||
76 | /** |
||
77 | * @return int|string |
||
78 | */ |
||
79 | public function getId() |
||
83 | |||
84 | /** |
||
85 | * @return bool |
||
86 | 2 | */ |
|
87 | public function hasPrices() |
||
91 | |||
92 | /** |
||
93 | * @return PriceInterface[] |
||
94 | */ |
||
95 | public function getPrices() |
||
99 | |||
100 | /** |
||
101 | * @param PriceInterface[] $prices |
||
102 | */ |
||
103 | public function setPrices(array $prices) |
||
110 | |||
111 | /** |
||
112 | * Calculate charges for given action. |
||
113 | * @param ActionInterface $action |
||
114 | * @return Charge[]|ChargeInterface[] |
||
115 | 4 | */ |
|
116 | public function calculateCharges(ActionInterface $action) |
||
128 | |||
129 | public function jsonSerialize() |
||
133 | |||
134 | /** |
||
135 | * @return CustomerInterface |
||
136 | */ |
||
137 | public function getSeller(): ?CustomerInterface |
||
141 | } |
||
142 |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.