1 | <?php |
||
10 | class Tuple extends ArrayObject |
||
11 | { |
||
12 | /** |
||
13 | * Initializes a new instance of this class. |
||
14 | * |
||
15 | * @param array|Iterator $components The components to set. |
||
16 | */ |
||
17 | 44 | public function __construct($components = array()) |
|
27 | |||
28 | /** |
||
29 | * Adds an element to the tuple. |
||
30 | * |
||
31 | * @param float|BigNumber $value The value to add. |
||
32 | * @return int Returns the index of the element that was added. |
||
33 | */ |
||
34 | 1 | public function addElement($value) |
|
42 | |||
43 | /** |
||
44 | * Gets the element located at the given index. |
||
45 | * |
||
46 | * @param int $index The index of the element to get. |
||
47 | * @return BigNumber |
||
48 | */ |
||
49 | 20 | public function getElement($index) |
|
55 | |||
56 | /** |
||
57 | * Removes the element located at the given index. |
||
58 | * |
||
59 | * @param int $index The index of the element to remove. |
||
60 | * @return null|BigNumber Returns the element that is removed or null if nothing was removed. |
||
61 | */ |
||
62 | 2 | public function removeElementIndex($index) |
|
74 | |||
75 | /** |
||
76 | * Removes the given element. |
||
77 | * |
||
78 | * @param float|BigNumber $element The element to remove. |
||
79 | * @return bool Returns true when the element was removed; false otherwise. |
||
80 | */ |
||
81 | 2 | public function removeElement($element) |
|
94 | |||
95 | /** |
||
96 | * Sets the element located at the given index. |
||
97 | * |
||
98 | * @param int $index The index of the element to get. |
||
99 | * @param float|BigNumber $value The value to set. |
||
100 | */ |
||
101 | 44 | public function setElement($index, $value) |
|
113 | |||
114 | /** |
||
115 | * Validates the index. |
||
116 | * |
||
117 | * @param int $index The index to validate. |
||
118 | * @param bool $indexShouldExists Whether or not the index should exists. |
||
119 | * @throws InvalidArgumentException Thrown when the index is invalid. |
||
120 | */ |
||
121 | 34 | protected function validateIndex($index, $indexShouldExists) |
|
131 | |||
132 | /** |
||
133 | * Gets the amount of components in this tuple. |
||
134 | * |
||
135 | * @return int |
||
136 | */ |
||
137 | 20 | public function getSize() |
|
141 | |||
142 | /** |
||
143 | * Gets the maximum value in the tuple. |
||
144 | * |
||
145 | * @return BigNumber |
||
146 | */ |
||
147 | 1 | public function getMaximumValue() |
|
151 | |||
152 | /** |
||
153 | * Gets the minimum value in the tuple. |
||
154 | * |
||
155 | * @return BigNumber |
||
156 | */ |
||
157 | 1 | public function getMinimumValue() |
|
161 | |||
162 | /** |
||
163 | * Converts this tuple to a string. |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | 10 | public function toString() |
|
171 | |||
172 | /** |
||
173 | * Converts this tuple to a string. |
||
174 | * |
||
175 | * @return string |
||
176 | */ |
||
177 | 9 | public function __toString() |
|
181 | } |
||
182 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: