1 | <?php |
||
39 | class AddElements implements WorkerInterface |
||
40 | { |
||
41 | /** |
||
42 | * @var array Available form elements |
||
43 | */ |
||
44 | public static $elements = [ |
||
45 | 'button' => Button::class, |
||
46 | 'fieldset' => FieldSet::class, |
||
47 | 'label' => Label::class, |
||
48 | 'reset' => Reset::class, |
||
49 | 'submit' => Submit::class, |
||
50 | 'checkbox' => Checkbox::class, |
||
51 | 'hidden' => Hidden::class, |
||
52 | 'password' => Password::class, |
||
53 | 'select' => Select::class, |
||
54 | 'text' => Text::class, |
||
55 | 'textarea' => TextArea::class, |
||
56 | 'file' => File::class |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * @var array List of validators that adds required attribute to input |
||
61 | */ |
||
62 | public static $triggerRequired = [ |
||
63 | 'notEmpty', 'email', 'url' |
||
64 | ]; |
||
65 | |||
66 | private static $form; |
||
67 | |||
68 | /** |
||
69 | * Adds or changes a specific aspect of provided from |
||
70 | * |
||
71 | * @param ContainerInterface $form |
||
72 | * @param array $data |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | 36 | public static function execute(ContainerInterface $form, array $data) |
|
91 | |||
92 | /** |
||
93 | * Recursively creates the elements to add to the form |
||
94 | * |
||
95 | * @param array $element |
||
96 | * |
||
97 | * @return ElementInterface |
||
98 | */ |
||
99 | 36 | protected static function create(array $element) |
|
108 | |||
109 | /** |
||
110 | * Sets the properties and dependencies for input elements |
||
111 | * |
||
112 | * @param ElementInterface $input |
||
113 | * @param array $data |
||
114 | */ |
||
115 | 36 | protected static function populateInputs( |
|
132 | |||
133 | /** |
||
134 | * Sets the properties and dependencies for HTML elements |
||
135 | * |
||
136 | * @param ElementInterface $elm |
||
137 | * @param array $data |
||
138 | */ |
||
139 | 36 | protected static function populateElement(ElementInterface $elm, array $data) |
|
153 | |||
154 | /** |
||
155 | * Adds the value to the element |
||
156 | * |
||
157 | * @param ElementInterface $elm |
||
158 | * @param array $data |
||
159 | */ |
||
160 | 36 | protected static function setValue(ElementInterface $elm, $data) |
|
166 | |||
167 | /** |
||
168 | * Check the element alias or FQ class name |
||
169 | * |
||
170 | * @param string $type |
||
171 | * |
||
172 | * @return string The Element class name |
||
173 | */ |
||
174 | 36 | protected static function getClassName($type) |
|
195 | |||
196 | /** |
||
197 | * Add filter to the input filter chain |
||
198 | * |
||
199 | * @param InputInterface $input |
||
200 | * @param array $data |
||
201 | */ |
||
202 | 36 | protected static function setFilters(InputInterface $input, array $data) |
|
213 | |||
214 | /** |
||
215 | * Add validators to the input validator chain |
||
216 | * |
||
217 | * @param InputInterface $input |
||
218 | * @param array $data |
||
219 | */ |
||
220 | 36 | protected static function addValidators(InputInterface $input, array $data) |
|
236 | |||
237 | /** |
||
238 | * Adds the html Label element to input |
||
239 | * |
||
240 | * @param InputInterface $input |
||
241 | * @param array $data |
||
242 | */ |
||
243 | 36 | protected static function addLabel(InputInterface $input, array $data) |
|
257 | |||
258 | /** |
||
259 | * Check if validator triggers the required attribute |
||
260 | * |
||
261 | * @param string $name Validator name |
||
262 | * @param InputInterface $input |
||
263 | */ |
||
264 | 30 | protected static function checkIfRequired($name, InputInterface $input) |
|
270 | |||
271 | /** |
||
272 | * Set options for ChoiceAwareElementInterface input types like Select |
||
273 | * |
||
274 | * @param InputInterface $input |
||
275 | * @param $data |
||
276 | */ |
||
277 | 36 | protected static function addOptions(InputInterface $input, $data) |
|
288 | |||
289 | } |
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: