1 | <?php |
||
15 | class HashSet extends SetAbstract |
||
16 | { |
||
17 | /** |
||
18 | * @var HashMap |
||
19 | */ |
||
20 | protected $map; |
||
21 | |||
22 | /** |
||
23 | * Constructs a new HashSet instance |
||
24 | * It can be passed default values, and will implicitely remove |
||
25 | * any duplicates |
||
26 | * @param array |
||
27 | */ |
||
28 | public function __construct($array = []) |
||
34 | |||
35 | /** |
||
36 | * Adds the specified element to this set if it is not already present. |
||
37 | * More formally, adds the specified element e to this set if this set |
||
38 | * contains no element e2 such that (e==null ? e2==null : e.equals(e2)). |
||
39 | * If this set already contains the element, the call leaves the set unchanged |
||
40 | * and returns false. |
||
41 | * @param multitype $element |
||
42 | * @return boolean |
||
43 | */ |
||
44 | public function add($element) |
||
56 | |||
57 | /** |
||
58 | * Removes all of the elements from this set. |
||
59 | * The set will be empty after this call returns. |
||
60 | * @return void |
||
61 | */ |
||
62 | public function clear() |
||
66 | |||
67 | /** |
||
68 | * Returns true if this collection contains the specified element. |
||
69 | * @return boolean; |
||
70 | */ |
||
71 | public function contains($element) |
||
75 | |||
76 | /** |
||
77 | * Returns an iterator over the elements in this collection. |
||
78 | * @return IteratorInterface |
||
79 | */ |
||
80 | public function iterator() |
||
84 | |||
85 | /** |
||
86 | * Removes a single instance of the specified element from this collection, if it is present (optional operation). |
||
87 | * @param multitype $element |
||
88 | * @return boolean |
||
89 | */ |
||
90 | public function remove($element) |
||
100 | |||
101 | /** |
||
102 | * Returns the number of elements in this collection. |
||
103 | * @return int |
||
104 | */ |
||
105 | public function size() |
||
109 | |||
110 | /** |
||
111 | * Returns an array containing all of the elements in this collection. |
||
112 | * @return array |
||
113 | */ |
||
114 | public function toArray() |
||
118 | |||
119 | /** |
||
120 | * Return a general hashing function for elements |
||
121 | * @param unknown $element |
||
122 | * @return string |
||
123 | */ |
||
124 | protected function getHash($element) |
||
128 | } |
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: