1 | <?php |
||
33 | class SerializerFactory { |
||
34 | |||
35 | const OPTION_DEFAULT = 0; |
||
36 | /** @since 1.2.0 */ |
||
37 | const OPTION_OBJECTS_FOR_MAPS = 1; |
||
38 | /** |
||
39 | * Omit hashes when serializing snaks. |
||
40 | * @since 2.5.0 |
||
41 | */ |
||
42 | const OPTION_SERIALIZE_SNAKS_WITHOUT_HASH = 2; |
||
43 | |||
44 | /** |
||
45 | * @var int |
||
46 | */ |
||
47 | private $options; |
||
48 | |||
49 | /** |
||
50 | * @var Serializer |
||
51 | */ |
||
52 | private $dataValueSerializer; |
||
53 | |||
54 | /** |
||
55 | * @param Serializer $dataValueSerializer serializer for DataValue objects |
||
56 | * @param int $options set multiple with bitwise or |
||
57 | * |
||
58 | * @throws InvalidArgumentException |
||
59 | */ |
||
60 | 52 | public function __construct( Serializer $dataValueSerializer, $options = 0 ) { |
|
68 | |||
69 | /** |
||
70 | * @return bool |
||
71 | */ |
||
72 | 38 | private function shouldUseObjectsForMaps() { |
|
75 | |||
76 | /** |
||
77 | * @return bool |
||
78 | */ |
||
79 | 30 | private function shouldSerializeSnaksWithHash() { |
|
82 | |||
83 | /** |
||
84 | * Returns a Serializer that can serialize Item and Property objects. |
||
85 | * |
||
86 | * @return Serializer |
||
87 | */ |
||
88 | 1 | public function newEntitySerializer() { |
|
94 | |||
95 | /** |
||
96 | * Returns a Serializer that can serialize Item objects. |
||
97 | * |
||
98 | * @since 2.1 |
||
99 | * |
||
100 | * @return Serializer |
||
101 | */ |
||
102 | 8 | public function newItemSerializer() { |
|
111 | |||
112 | /** |
||
113 | * Returns a Serializer that can serialize Property objects. |
||
114 | * |
||
115 | * @since 2.1 |
||
116 | * |
||
117 | * @return Serializer |
||
118 | */ |
||
119 | 3 | public function newPropertySerializer() { |
|
126 | |||
127 | /** |
||
128 | * Returns a Serializer that can serialize SiteLink objects. |
||
129 | * |
||
130 | * @return Serializer |
||
131 | */ |
||
132 | 12 | public function newSiteLinkSerializer() { |
|
135 | |||
136 | /** |
||
137 | * Returns a Serializer that can serialize StatementList objects. |
||
138 | * |
||
139 | * @since 1.4 |
||
140 | * |
||
141 | * @return Serializer |
||
142 | */ |
||
143 | 14 | public function newStatementListSerializer() { |
|
149 | |||
150 | /** |
||
151 | * Returns a Serializer that can serialize Statement objects. |
||
152 | * |
||
153 | * @since 1.4 |
||
154 | * |
||
155 | * @return Serializer |
||
156 | */ |
||
157 | 22 | public function newStatementSerializer() { |
|
164 | |||
165 | /** |
||
166 | * Returns a Serializer that can serialize ReferenceList objects. |
||
167 | * |
||
168 | * @return Serializer |
||
169 | */ |
||
170 | 26 | public function newReferencesSerializer() { |
|
173 | |||
174 | /** |
||
175 | * Returns a Serializer that can serialize Reference objects. |
||
176 | * |
||
177 | * @return Serializer |
||
178 | */ |
||
179 | 30 | public function newReferenceSerializer() { |
|
184 | |||
185 | /** |
||
186 | * Returns a Serializer that can serialize SnakList objects. |
||
187 | * |
||
188 | * @param bool $serializeSnaksWithHash |
||
189 | * |
||
190 | * @since 1.4 |
||
191 | * |
||
192 | * @return Serializer |
||
193 | */ |
||
194 | 36 | public function newSnakListSerializer( $serializeSnaksWithHash = true ) { |
|
200 | |||
201 | /** |
||
202 | * Returns a Serializer that can serialize Snak objects. |
||
203 | * |
||
204 | * @param bool $serializeWithHash |
||
205 | * |
||
206 | * @return Serializer |
||
207 | */ |
||
208 | 43 | public function newSnakSerializer( $serializeWithHash = true ) { |
|
211 | |||
212 | /** |
||
213 | * Returns a Serializer that can serialize TypedSnak objects. |
||
214 | * |
||
215 | * @param bool $serializeWithHash |
||
216 | * |
||
217 | * @since 1.3 |
||
218 | * |
||
219 | * @return Serializer |
||
220 | */ |
||
221 | 1 | public function newTypedSnakSerializer( $serializeWithHash = true ) { |
|
224 | |||
225 | /** |
||
226 | * Returns a Serializer that can serialize Term objects. |
||
227 | * |
||
228 | * @since 1.5 |
||
229 | * |
||
230 | * @return Serializer |
||
231 | */ |
||
232 | 12 | public function newTermSerializer() { |
|
235 | |||
236 | /** |
||
237 | * Returns a Serializer that can serialize TermList objects. |
||
238 | * |
||
239 | * @since 1.5 |
||
240 | * |
||
241 | * @return Serializer |
||
242 | */ |
||
243 | 11 | public function newTermListSerializer() { |
|
246 | |||
247 | /** |
||
248 | * Returns a Serializer that can serialize AliasGroup objects. |
||
249 | * |
||
250 | * @since 1.6 |
||
251 | * |
||
252 | * @return Serializer |
||
253 | */ |
||
254 | 12 | public function newAliasGroupSerializer() { |
|
257 | |||
258 | /** |
||
259 | * Returns a Serializer that can serialize AliasGroupList objects. |
||
260 | * |
||
261 | * @since 1.5 |
||
262 | * |
||
263 | * @return Serializer |
||
264 | */ |
||
265 | 11 | public function newAliasGroupListSerializer() { |
|
268 | |||
269 | } |
||
270 |
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: