1 | <?php |
||
16 | abstract class AbstractForm implements FormInterface, Iterator |
||
17 | { |
||
18 | /** @var array<FormElement> */ |
||
19 | protected $form; |
||
20 | |||
21 | /** |
||
22 | * FormInterface constructor. Creates <FORM> element automatically. |
||
23 | * |
||
24 | * @param string $name |
||
25 | * @param string $action |
||
26 | * @param string $method |
||
27 | */ |
||
28 | public function __construct($name, $action = '', $method = 'POST') |
||
39 | |||
40 | /** |
||
41 | * Initialize form. |
||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | abstract protected function initForm(); |
||
46 | |||
47 | /** |
||
48 | * Set unique identifier for the form. |
||
49 | * |
||
50 | * @param string $uniqueFormNamePostfix |
||
51 | * @return AbstractForm |
||
52 | */ |
||
53 | protected function setUniqueFormNamePostfix($uniqueFormNamePostfix) |
||
59 | |||
60 | /** |
||
61 | * Sets form action. |
||
62 | * |
||
63 | * @param string $action |
||
64 | * @return AbstractForm |
||
65 | */ |
||
66 | protected function setAction($action) |
||
72 | |||
73 | /** |
||
74 | * Sets form submit. |
||
75 | * |
||
76 | * @param string $method |
||
77 | * @return AbstractForm |
||
78 | */ |
||
79 | protected function setMethod($method = 'POST') |
||
85 | |||
86 | /** |
||
87 | * Sets form autocomplete option. |
||
88 | * |
||
89 | * @param bool $autocomplete |
||
90 | * @return AbstractForm |
||
91 | */ |
||
92 | protected function setAutocomplete($autocomplete = true) |
||
98 | |||
99 | /** |
||
100 | * Sets form encryption type. |
||
101 | * |
||
102 | * @param string $enctype |
||
103 | * @return AbstractForm |
||
104 | */ |
||
105 | protected function setEnctype($enctype = 'application/x-www-form-urlencoded') |
||
111 | |||
112 | /** |
||
113 | * Adds a form element to the form. |
||
114 | * |
||
115 | * @param FormElement $formElement |
||
116 | * @return AbstractForm |
||
117 | */ |
||
118 | protected function addChildNode(FormElement $formElement) |
||
126 | |||
127 | /** |
||
128 | * Gets the form elements. |
||
129 | * |
||
130 | * @return array<FormElement> |
||
131 | */ |
||
132 | public function getChildNodes() |
||
136 | |||
137 | /** |
||
138 | * Validates the form. |
||
139 | * |
||
140 | * @return boolean |
||
141 | */ |
||
142 | public function isValid() |
||
150 | |||
151 | /** |
||
152 | * Sets form data. |
||
153 | * |
||
154 | * @param array $data |
||
155 | * @return FormInterface |
||
156 | */ |
||
157 | public function setData(array $data) |
||
168 | |||
169 | /** |
||
170 | * Returns the form data. |
||
171 | * |
||
172 | * @return array |
||
173 | */ |
||
174 | public function getData() |
||
179 | |||
180 | /** |
||
181 | * Return the current element. |
||
182 | * |
||
183 | * @return FormElement |
||
184 | */ |
||
185 | final public function current() |
||
189 | |||
190 | /** |
||
191 | * Moves the pointer forward to next element. |
||
192 | * |
||
193 | * @return void |
||
194 | */ |
||
195 | final public function next() |
||
199 | |||
200 | /** |
||
201 | * Returns the key of the current element. |
||
202 | * |
||
203 | * @return mixed |
||
204 | */ |
||
205 | final public function key() |
||
209 | |||
210 | /** |
||
211 | * Checks if current position is valid. |
||
212 | * |
||
213 | * @return boolean |
||
214 | */ |
||
215 | final public function valid() |
||
221 | |||
222 | /** |
||
223 | * Rewinds the Iterator to the first element. |
||
224 | * |
||
225 | * @return void |
||
226 | */ |
||
227 | final public function rewind() |
||
231 | } |
||
232 |
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: