@@ -850,8 +850,7 @@ In the above example, Symfony can guess from the validation rules that the
850850``task `` field is a normal ``TextType `` field and the ``dueDate `` field is a
851851``DateType `` field.
852852
853- To enable Symfony's "guessing mechanism", omit the second argument to the ``add() `` method, or
854- pass ``null `` to it::
853+ To enable Symfony's "guessing mechanism", omit the second argument to the ``add() `` method::
855854
856855 // src/Form/Type/TaskType.php
857856 namespace App\Form\Type;
@@ -869,8 +868,8 @@ pass ``null`` to it::
869868 $builder
870869 // if you don't define field options, you can omit the second argument
871870 ->add('task')
872- // if you define field options, pass NULL as second argument
873- ->add('dueDate', null, ['required' => false])
871+ // if you define field options, use named argument
872+ ->add('dueDate', options: ['required' => false])
874873 ->add('save', SubmitType::class)
875874 ;
876875 }
@@ -902,7 +901,7 @@ the following options will be guessed too:
902901
903902If you'd like to change one of the guessed values, override it in the options field array::
904903
905- ->add('task', null, ['attr' => ['maxlength' => 4]])
904+ ->add('task', options: ['attr' => ['maxlength' => 4]])
906905
907906.. seealso ::
908907
0 commit comments