Revert "[BUGFIX] Fix serializable object creation with PHP 5.6"
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Object / Container / Fixtures / Testclasses.php
1 <?php
2 /**
3 * a singleton class
4 */
5 class t3lib_object_tests_singleton implements \TYPO3\CMS\Core\SingletonInterface {
6
7 }
8
9 /**
10 * test class A that depends on B and C
11 */
12 class t3lib_object_tests_a {
13
14 public $b;
15
16 public $c;
17
18 /**
19 * @param \t3lib_object_tests_c $c
20 * @param \t3lib_object_tests_b $b
21 */
22 public function __construct(\t3lib_object_tests_c $c, \t3lib_object_tests_b $b) {
23 $this->b = $b;
24 $this->c = $c;
25 }
26 }
27
28 /**
29 * test class A that depends on B and C and has a third default parameter in constructor
30 */
31 class t3lib_object_tests_amixed_array {
32
33 public $b;
34
35 public $c;
36
37 public $myvalue;
38
39 /**
40 * @param \t3lib_object_tests_b $b
41 * @param \t3lib_object_tests_c $c
42 * @param array $myvalue
43 */
44 public function __construct(\t3lib_object_tests_b $b, \t3lib_object_tests_c $c, array $myvalue = array('some' => 'default')) {
45 $this->b = $b;
46 $this->c = $c;
47 $this->myvalue = $myvalue;
48 }
49 }
50
51 /**
52 * test class A that depends on B and C and has a third default parameter in constructor that defaults to NULL
53 */
54 class t3lib_object_tests_amixed_null {
55
56 public $b;
57
58 public $c;
59
60 public $myvalue;
61
62 /**
63 * @param \t3lib_object_tests_b $b
64 * @param \t3lib_object_tests_c $c
65 * @param mixed $myvalue
66 */
67 public function __construct(\t3lib_object_tests_b $b, \t3lib_object_tests_c $c, $myvalue = NULL) {
68 $this->b = $b;
69 $this->c = $c;
70 $this->myvalue = $myvalue;
71 }
72 }
73
74 /**
75 * test class A that depends on B and C and has a third default parameter in constructor
76 */
77 class t3lib_object_tests_amixed_array_singleton implements \TYPO3\CMS\Core\SingletonInterface {
78
79 public $b;
80
81 public $c;
82
83 public $myvalue;
84
85 /**
86 * @param \t3lib_object_tests_b $b
87 * @param \t3lib_object_tests_c $c
88 * @param array $someDefaultParameter
89 */
90 public function __construct(\t3lib_object_tests_b $b, \t3lib_object_tests_c $c, $someDefaultParameter = array('some' => 'default')) {
91 $this->b = $b;
92 $this->c = $c;
93 $this->myvalue = $someDefaultParameter;
94 }
95 }
96
97 /**
98 * test class B that depends on C
99 */
100 class t3lib_object_tests_b implements \TYPO3\CMS\Core\SingletonInterface {
101
102 public $c;
103
104 /**
105 * @param \t3lib_object_tests_c $c
106 */
107 public function __construct(\t3lib_object_tests_c $c) {
108 $this->c = $c;
109 }
110 }
111
112 /**
113 * test class C without dependencys
114 */
115 class t3lib_object_tests_c implements \TYPO3\CMS\Core\SingletonInterface {
116
117 }
118
119 /**
120 * test class B-Child that extends Class B (therfore depends also on Class C)
121 */
122 class t3lib_object_tests_b_child extends \t3lib_object_tests_b {
123
124 }
125
126 /**
127
128 */
129 interface t3lib_object_tests_someinterface extends \TYPO3\CMS\Core\SingletonInterface {
130
131 }
132
133 /**
134 * class which implements a Interface
135 */
136 class t3lib_object_tests_someimplementation implements \t3lib_object_tests_someinterface {
137
138 }
139
140 /**
141 * test class B-Child that extends Class B (therfore depends also on Class C)
142 */
143 class t3lib_object_tests_b_child_someimplementation extends \t3lib_object_tests_b implements \t3lib_object_tests_someinterface {
144
145 }
146
147 /**
148 * class which depends on a Interface
149 */
150 class t3lib_object_tests_needsinterface {
151
152 /**
153 * @param \t3lib_object_tests_someinterface $i
154 */
155 public function __construct(\t3lib_object_tests_someinterface $i) {
156 $this->dependency = $i;
157 }
158 }
159
160 /**
161 * Prototype classes that depend on each other
162 */
163 class t3lib_object_tests_cyclic1 {
164
165 /**
166 * @param \t3lib_object_tests_cyclic2 $c
167 */
168 public function __construct(\t3lib_object_tests_cyclic2 $c) {
169 }
170 }
171
172 /**
173
174 */
175 class t3lib_object_tests_cyclic2 {
176
177 /**
178 * @param \t3lib_object_tests_cyclic1 $c
179 */
180 public function __construct(\t3lib_object_tests_cyclic1 $c) {
181 }
182 }
183
184 /**
185
186 */
187 class t3lib_object_tests_cyclic1WithSetterDependency {
188
189 /**
190 * @param \t3lib_object_tests_cyclic2WithSetterDependency $c
191 */
192 public function injectFoo(\t3lib_object_tests_cyclic2WithSetterDependency $c) {
193 }
194 }
195
196 /**
197
198 */
199 class t3lib_object_tests_cyclic2WithSetterDependency {
200
201 /**
202 * @param \t3lib_object_tests_cyclic1WithSetterDependency $c
203 */
204 public function injectFoo(\t3lib_object_tests_cyclic1WithSetterDependency $c) {
205 }
206 }
207
208 /**
209 * class which has setter injections defined
210 */
211 class t3lib_object_tests_injectmethods {
212
213 public $b;
214
215 public $bchild;
216
217 /**
218 * @param \t3lib_object_tests_b $o
219 */
220 public function injectClassB(\t3lib_object_tests_b $o) {
221 $this->b = $o;
222 }
223
224 /**
225 * @inject
226 * @param \t3lib_object_tests_b_child $o
227 */
228 public function setClassBChild(\t3lib_object_tests_b_child $o) {
229 $this->bchild = $o;
230 }
231 }
232
233 /**
234 * class which needs extenson settings injected
235 */
236 class t3lib_object_tests_injectsettings {
237
238 public $settings;
239
240 /**
241 * @param array $settings
242 */
243 public function injectExtensionSettings(array $settings) {
244 $this->settings = $settings;
245 }
246 }
247
248 /**
249
250 */
251 class t3lib_object_tests_resolveablecyclic1 implements \TYPO3\CMS\Core\SingletonInterface {
252
253 public $o2;
254
255 /**
256 * @param \t3lib_object_tests_resolveablecyclic2 $cyclic2
257 */
258 public function __construct(\t3lib_object_tests_resolveablecyclic2 $cyclic2) {
259 $this->o2 = $cyclic2;
260 }
261 }
262
263 /**
264
265 */
266 class t3lib_object_tests_resolveablecyclic2 implements \TYPO3\CMS\Core\SingletonInterface {
267
268 public $o1;
269
270 public $o3;
271
272 /**
273 * @param \t3lib_object_tests_resolveablecyclic1 $cyclic1
274 */
275 public function injectCyclic1(\t3lib_object_tests_resolveablecyclic1 $cyclic1) {
276 $this->o1 = $cyclic1;
277 }
278
279 /**
280 * @param \t3lib_object_tests_resolveablecyclic3 $cyclic3
281 */
282 public function injectCyclic3(\t3lib_object_tests_resolveablecyclic3 $cyclic3) {
283 $this->o3 = $cyclic3;
284 }
285 }
286
287 /**
288
289 */
290 class t3lib_object_tests_resolveablecyclic3 implements \TYPO3\CMS\Core\SingletonInterface {
291
292 public $o1;
293
294 /**
295 * @param \t3lib_object_tests_resolveablecyclic1 $cyclic1
296 */
297 public function injectCyclic1(\t3lib_object_tests_resolveablecyclic1 $cyclic1) {
298 $this->o1 = $cyclic1;
299 }
300 }
301
302 /**
303
304 */
305 class t3lib_object_tests_class_with_injectsettings {
306
307 /**
308 * @param \t3lib_object_tests_resolveablecyclic1 $c1
309 */
310 public function injectFoo(\t3lib_object_tests_resolveablecyclic1 $c1) {
311 }
312
313 /**
314 * @param \t3lib_object_tests_resolveablecyclic1 $c1
315 */
316 public function injectingFoo(\t3lib_object_tests_resolveablecyclic1 $c1) {
317
318 }
319
320 /**
321 * @param array $settings
322 */
323 public function injectSettings(array $settings) {
324 }
325 }
326
327 /*
328 * a Singleton requires a Prototype for Injection -> allowed, autowiring active, but in development context we write a log message, as it is bad practice and most likely points to some logic error.
329 If a Singleton requires a Singleton for Injection -> allowed, autowiring active
330 If a Prototype requires a Prototype for Injection -> allowed, autowiring active
331 If a Prototype requires a Singleton for Injection -> allowed, autowiring active
332 */
333 /**
334
335 */
336 class t3lib_object_singleton implements \TYPO3\CMS\Core\SingletonInterface {
337
338 }
339
340 /**
341
342 */
343 class t3lib_object_prototype {
344
345 }
346
347 /**
348
349 */
350 class t3lib_object_singletonNeedsPrototype implements \TYPO3\CMS\Core\SingletonInterface {
351
352 /**
353 * @var \t3lib_object_prototype
354 */
355 public $dependency;
356
357 /**
358 * @param \t3lib_object_prototype $dependency
359 */
360 public function injectDependency(\t3lib_object_prototype $dependency) {
361 $this->dependency = $dependency;
362 }
363 }
364
365 /**
366
367 */
368 class t3lib_object_singletonNeedsSingleton implements \TYPO3\CMS\Core\SingletonInterface {
369
370 /**
371 * @var \t3lib_object_singleton
372 */
373 public $dependency;
374
375 /**
376 * @param \t3lib_object_singleton $dependency
377 */
378 public function injectDependency(\t3lib_object_singleton $dependency) {
379 $this->dependency = $dependency;
380 }
381 }
382
383 /**
384
385 */
386 class t3lib_object_prototypeNeedsPrototype {
387
388 /**
389 * @var \t3lib_object_prototype
390 */
391 public $dependency;
392
393 /**
394 * @param \t3lib_object_prototype $dependency
395 */
396 public function injectDependency(\t3lib_object_prototype $dependency) {
397 $this->dependency = $dependency;
398 }
399 }
400
401 /**
402
403 */
404 class t3lib_object_prototypeNeedsSingleton {
405
406 /**
407 * @var \t3lib_object_singleton
408 */
409 public $dependency;
410
411 /**
412 * @param \t3lib_object_singleton $dependency
413 */
414 public function injectDependency(\t3lib_object_singleton $dependency) {
415 $this->dependency = $dependency;
416 }
417 }
418
419 /**
420
421 */
422 class t3lib_object_singletonNeedsPrototypeInConstructor implements \TYPO3\CMS\Core\SingletonInterface {
423
424 /**
425 * @param \t3lib_object_prototype $dependency
426 */
427 public function __construct(\t3lib_object_prototype $dependency) {
428 $this->dependency = $dependency;
429 }
430 }
431
432 /**
433
434 */
435 class t3lib_object_singletonNeedsSingletonInConstructor implements \TYPO3\CMS\Core\SingletonInterface {
436
437 /**
438 * @param \t3lib_object_singleton $dependency
439 */
440 public function __construct(\t3lib_object_singleton $dependency) {
441 $this->dependency = $dependency;
442 }
443 }
444
445 /**
446
447 */
448 class t3lib_object_prototypeNeedsPrototypeInConstructor {
449
450 /**
451 * @param \t3lib_object_prototype $dependency
452 */
453 public function __construct(\t3lib_object_prototype $dependency) {
454 $this->dependency = $dependency;
455 }
456 }
457
458 /**
459
460 */
461 class t3lib_object_prototypeNeedsSingletonInConstructor {
462
463 /**
464 * @param \t3lib_object_singleton $dependency
465 */
466 public function __construct(\t3lib_object_singleton $dependency) {
467 $this->dependency = $dependency;
468 }
469 }