[BUGFIX] Omit constructor injection for optional parameters
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Object / Container / Fixtures / ContainerConstructorInjectionTestFixtures.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Object\Container\Fixtures;
3
4
5 class SimpleTypeConstructorArgument {
6
7 /**
8 * @var boolean
9 */
10 public $foo;
11
12 /**
13 * @param boolean $foo
14 */
15 public function __construct($foo = FALSE) {
16 $this->foo = $foo;
17 }
18 }
19
20
21 class ArgumentTestClass {
22
23 }
24
25
26 class MandatoryConstructorArgument {
27
28 /**
29 * @var ArgumentTestClass
30 */
31 public $argumentTestClass;
32
33 public $allArguments;
34
35 /**
36 * @param ArgumentTestClass $argumentTestClass
37 */
38 public function __construct(ArgumentTestClass $argumentTestClass) {
39 $this->argumentTestClass = $argumentTestClass;
40 $this->allArguments = func_get_args();
41 }
42 }
43
44
45 class OptionalConstructorArgument {
46
47 /**
48 * @var ArgumentTestClass
49 */
50 public $argumentTestClass;
51
52 /**
53 * @param ArgumentTestClass $argumentTestClass
54 */
55 public function __construct(ArgumentTestClass $argumentTestClass = NULL) {
56 $this->argumentTestClass = $argumentTestClass;
57 }
58 }
59
60
61 class MandatoryConstructorArgumentTwo {
62
63 /**
64 * @var ArgumentTestClass
65 */
66 public $argumentTestClass;
67
68 /**
69 * @var ArgumentTestClass
70 */
71 public $argumentTestClassTwo;
72
73 /**
74 * @param ArgumentTestClass $argumentTestClass
75 * @param ArgumentTestClass $argumentTestClassTwo
76 */
77 public function __construct(ArgumentTestClass $argumentTestClass, ArgumentTestClass $argumentTestClassTwo) {
78 $this->argumentTestClass = $argumentTestClass;
79 $this->argumentTestClassTwo = $argumentTestClassTwo;
80 }
81 }
82
83
84 class TwoConstructorArgumentsSecondOptional {
85
86 /**
87 * @var ArgumentTestClass
88 */
89 public $argumentTestClass;
90
91 /**
92 * @var ArgumentTestClass
93 */
94 public $argumentTestClassTwo;
95
96 /**
97 * @param ArgumentTestClass $argumentTestClass
98 * @param ArgumentTestClass $argumentTestClassTwo
99 */
100 public function __construct(ArgumentTestClass $argumentTestClass, ArgumentTestClass $argumentTestClassTwo = NULL) {
101 $this->argumentTestClass = $argumentTestClass;
102 $this->argumentTestClassTwo = $argumentTestClassTwo;
103 }
104 }
105
106
107 class TwoConstructorArgumentsFirstOptional {
108
109 /**
110 * @var ArgumentTestClass
111 */
112 public $argumentTestClass;
113
114 /**
115 * @var ArgumentTestClass
116 */
117 public $argumentTestClassTwo;
118
119 /**
120 * This can not be handled correctly at the moment since the underlying
121 * reflection API of PHP marks the first parameter as required!
122 *
123 * @param ArgumentTestClass $argumentTestClass
124 * @param ArgumentTestClass $argumentTestClassTwo
125 */
126 public function __construct(ArgumentTestClass $argumentTestClass = NULL, ArgumentTestClass $argumentTestClassTwo) {
127 $this->argumentTestClass = $argumentTestClass;
128 $this->argumentTestClassTwo = $argumentTestClassTwo;
129 }
130 }
131
132
133 class TwoConstructorArgumentsBothOptional {
134
135 /**
136 * @var ArgumentTestClass
137 */
138 public $argumentTestClass;
139
140 /**
141 * @var ArgumentTestClass
142 */
143 public $argumentTestClassTwo;
144
145 /**
146 * @param ArgumentTestClass $argumentTestClass
147 * @param ArgumentTestClass $argumentTestClassTwo
148 */
149 public function __construct(ArgumentTestClass $argumentTestClass = NULL, ArgumentTestClass $argumentTestClassTwo = NULL) {
150 $this->argumentTestClass = $argumentTestClass;
151 $this->argumentTestClassTwo = $argumentTestClassTwo;
152 }
153 }