11<?php
22
3+ /*
4+ * This file is part of the SymfonyCasts DynamicForms package.
5+ * Copyright (c) SymfonyCasts <https://symfonycasts.com/>
6+ * For the full copyright and license information, please view the LICENSE
7+ * file that was distributed with this source code.
8+ */
9+
310namespace Symfonycasts \DynamicForms ;
411
512use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
@@ -95,7 +102,7 @@ private function executeReadyCallbacks(array $availableDependencyData, string $e
95102 }
96103 }
97104
98- private function initializeListeners (? array $ fieldsToConsider = null ): void
105+ private function initializeListeners (array $ fieldsToConsider = null ): void
99106 {
100107 $ registeredFields = [];
101108 foreach ($ this ->dependentFieldConfigs as $ dynamicField ) {
@@ -133,6 +140,7 @@ public function count(): int
133140 public function add (string |FormBuilderInterface $ child , string $ type = null , array $ options = []): static
134141 {
135142 $ this ->builder ->add ($ child , $ type , $ options );
143+
136144 return $ this ;
137145 }
138146
@@ -149,6 +157,7 @@ public function get(string $name): FormBuilderInterface
149157 public function remove (string $ name ): static
150158 {
151159 $ this ->builder ->remove ($ name );
160+
152161 return $ this ;
153162 }
154163
@@ -170,240 +179,280 @@ public function getForm(): FormInterface
170179 public function addEventListener (string $ eventName , callable $ listener , int $ priority = 0 ): static
171180 {
172181 $ this ->builder ->addEventListener ($ eventName , $ listener , $ priority );
182+
173183 return $ this ;
174184 }
175185
176186 public function addEventSubscriber (EventSubscriberInterface $ subscriber ): static
177187 {
178188 $ this ->builder ->addEventSubscriber ($ subscriber );
189+
179190 return $ this ;
180191 }
181192
182193 public function addViewTransformer (DataTransformerInterface $ viewTransformer , bool $ forcePrepend = false ): static
183194 {
184195 $ this ->builder ->addViewTransformer ($ viewTransformer , $ forcePrepend );
196+
185197 return $ this ;
186198 }
187199
188200 public function resetViewTransformers (): static
189201 {
190202 $ this ->builder ->resetViewTransformers ();
203+
191204 return $ this ;
192205 }
193206
194207 public function addModelTransformer (DataTransformerInterface $ modelTransformer , bool $ forceAppend = false ): static
195208 {
196209 $ this ->builder ->addModelTransformer ($ modelTransformer , $ forceAppend );
210+
197211 return $ this ;
198212 }
199213
200214 public function resetModelTransformers (): static
201215 {
202216 $ this ->builder ->resetModelTransformers ();
217+
203218 return $ this ;
204219 }
205220
206221 public function setAttribute (string $ name , mixed $ value ): static
207222 {
208223 $ this ->builder ->setAttribute ($ name , $ value );
224+
209225 return $ this ;
210226 }
211227
212228 public function setAttributes (array $ attributes ): static
213229 {
214230 $ this ->builder ->setAttributes ($ attributes );
231+
215232 return $ this ;
216233 }
217234
218235 public function setDataMapper (?DataMapperInterface $ dataMapper ): static
219236 {
220237 $ this ->builder ->setDataMapper ($ dataMapper );
238+
221239 return $ this ;
222240 }
223241
224242 public function setDisabled (bool $ disabled ): static
225243 {
226244 $ this ->builder ->setDisabled ($ disabled );
245+
227246 return $ this ;
228247 }
229248
230249 public function setEmptyData (mixed $ emptyData ): static
231250 {
232251 $ this ->builder ->setEmptyData ($ emptyData );
252+
233253 return $ this ;
234254 }
235255
236256 public function setErrorBubbling (bool $ errorBubbling ): static
237257 {
238258 $ this ->builder ->setErrorBubbling ($ errorBubbling );
259+
239260 return $ this ;
240261 }
241262
242263 public function setErrorMapping (array $ errorMapping ): static
243264 {
244265 $ this ->builder ->setErrorMapping ($ errorMapping );
266+
245267 return $ this ;
246268 }
247269
248270 public function setHelp (?string $ help ): static
249271 {
250272 $ this ->builder ->setHelp ($ help );
273+
251274 return $ this ;
252275 }
253276
254277 public function setHelpAttr (array $ helpAttr ): static
255278 {
256279 $ this ->builder ->setHelpAttr ($ helpAttr );
280+
257281 return $ this ;
258282 }
259283
260284 public function setHelpHtml (bool $ helpHtml ): static
261285 {
262286 $ this ->builder ->setHelpHtml ($ helpHtml );
287+
263288 return $ this ;
264289 }
265290
266291 public function setInheritData (bool $ inheritData ): static
267292 {
268293 $ this ->builder ->setInheritData ($ inheritData );
294+
269295 return $ this ;
270296 }
271297
272298 public function setInvalidMessage (?string $ invalidMessage ): static
273299 {
274300 $ this ->builder ->setInvalidMessage ($ invalidMessage );
301+
275302 return $ this ;
276303 }
277304
278305 public function setInvalidMessageParameters (array $ invalidMessageParameters ): static
279306 {
280307 $ this ->builder ->setInvalidMessageParameters ($ invalidMessageParameters );
308+
281309 return $ this ;
282310 }
283311
284312 public function setLabel (?string $ label ): static
285313 {
286314 $ this ->builder ->setLabel ($ label );
315+
287316 return $ this ;
288317 }
289318
290319 public function setLabelAttr (array $ labelAttr ): static
291320 {
292321 $ this ->builder ->setLabelAttr ($ labelAttr );
322+
293323 return $ this ;
294324 }
295325
296326 public function setLabelFormat (?string $ labelFormat ): static
297327 {
298328 $ this ->builder ->setLabelFormat ($ labelFormat );
329+
299330 return $ this ;
300331 }
301332
302333 public function setLabelHtml (bool $ labelHtml ): static
303334 {
304335 $ this ->builder ->setLabelHtml ($ labelHtml );
336+
305337 return $ this ;
306338 }
307339
308340 public function setMapped (bool $ mapped ): static
309341 {
310342 $ this ->builder ->setMapped ($ mapped );
343+
311344 return $ this ;
312345 }
313346
314347 public function setMethod (string $ method ): static
315348 {
316349 $ this ->builder ->setMethod ($ method );
350+
317351 return $ this ;
318352 }
319353
320354 public function setOptions (array $ options ): static
321355 {
322356 $ this ->builder ->setOptions ($ options );
357+
323358 return $ this ;
324359 }
325360
326361 public function setPropertyPath (null |string |PropertyPathInterface $ propertyPath ): static
327362 {
328363 $ this ->builder ->setPropertyPath ($ propertyPath );
364+
329365 return $ this ;
330366 }
331367
332368 public function setRequired (bool $ required ): static
333369 {
334370 $ this ->builder ->setRequired ($ required );
371+
335372 return $ this ;
336373 }
337374
338375 public function setRowAttr (array $ rowAttr ): static
339376 {
340377 $ this ->builder ->setRowAttr ($ rowAttr );
378+
341379 return $ this ;
342380 }
343381
344382 public function setTranslationDomain (?string $ translationDomain ): static
345383 {
346384 $ this ->builder ->setTranslationDomain ($ translationDomain );
385+
347386 return $ this ;
348387 }
349388
350389 public function setTrim (bool $ trim ): static
351390 {
352391 $ this ->builder ->setTrim ($ trim );
392+
353393 return $ this ;
354394 }
355395
356396 public function setAction (?string $ action ): static
357397 {
358398 $ this ->builder ->setAction ($ action );
399+
359400 return $ this ;
360401 }
361402
362403 public function setCompound (bool $ compound ): static
363404 {
364405 $ this ->builder ->setCompound ($ compound );
406+
365407 return $ this ;
366408 }
367409
368410 public function setDataClass (?string $ dataClass ): static
369411 {
370412 $ this ->builder ->setDataClass ($ dataClass );
413+
371414 return $ this ;
372415 }
373416
374417 public function setDataLocked (bool $ locked ): static
375418 {
376419 $ this ->builder ->setDataLocked ($ locked );
420+
377421 return $ this ;
378422 }
379423
380424 public function setFormFactory (FormFactoryInterface $ formFactory ): static
381425 {
382426 $ this ->builder ->setFormFactory ($ formFactory );
427+
383428 return $ this ;
384429 }
385430
386431 public function setType (?ResolvedFormTypeInterface $ type ): static
387432 {
388433 $ this ->builder ->setType ($ type );
434+
389435 return $ this ;
390436 }
391437
392438 public function setTypeName (string $ typeName ): static
393439 {
394440 $ this ->builder ->setTypeName ($ typeName );
441+
395442 return $ this ;
396443 }
397444
398445 public function setEventDispatcher (EventDispatcherInterface $ dispatcher ): static
399446 {
400447 $ this ->builder ->setEventDispatcher ($ dispatcher );
448+
401449 return $ this ;
402450 }
403451
404452 public function setRequestHandler (?RequestHandlerInterface $ requestHandler ): static
405453 {
406454 $ this ->builder ->setRequestHandler ($ requestHandler );
455+
407456 return $ this ;
408457 }
409458
@@ -595,4 +644,3 @@ public function getIterator(): \Traversable
595644 return $ this ->builder ;
596645 }
597646}
598-
0 commit comments