@@ -107,23 +107,23 @@ class FormConfigBuilder implements FormConfigBuilderInterface
107107 /**
108108 * Creates an empty form configuration.
109109 *
110- * @param string|int $name The form name
110+ * @param string|null $name The form name
111111 * @param string|null $dataClass The class of the form's data
112112 * @param EventDispatcherInterface $dispatcher The event dispatcher
113113 * @param array $options The form options
114114 *
115115 * @throws InvalidArgumentException if the data class is not a valid class or if
116116 * the name contains invalid characters
117117 */
118- public function __construct ($ name , ?string $ dataClass , EventDispatcherInterface $ dispatcher , array $ options = [])
118+ public function __construct (? string $ name , ?string $ dataClass , EventDispatcherInterface $ dispatcher , array $ options = [])
119119 {
120120 self ::validateName ($ name );
121121
122122 if (null !== $ dataClass && !class_exists ($ dataClass ) && !interface_exists ($ dat
C0A6
aClass , false )) {
123123 throw new InvalidArgumentException (sprintf ('Class "%s" not found. Is the "data_class" form option set correctly? ' , $ dataClass ));
124124 }
125125
126- $ this ->name = ( string ) $ name ;
126+ $ this ->name = $ name ?? '' ;
127127 $ this ->dataClass = $ dataClass ;
128128 $ this ->dispatcher = $ dispatcher ;
129129 $ this ->options = $ options ;
@@ -767,15 +767,17 @@ public function getFormConfig()
767767 /**
768768 * Validates whether the given variable is a valid form name.
769769 *
770- * @param string|int| null $name The tested form name
770+ * @param string|null $name The tested form name
771771 *
772772 * @throws UnexpectedTypeException if the name is not a string or an integer
773773 * @throws InvalidArgumentException if the name contains invalid characters
774+ *
775+ * @internal since Symfony 4.4
774776 */
775777 public static function validateName ($ name )
776778 {
777- if (null !== $ name && !\is_string ($ name ) && ! \is_int ( $ name ) ) {
778- throw new UnexpectedTypeException ($ name , 'string, integer or null ' );
779+ if (null !== $ name && !\is_string ($ name )) {
780+ throw new UnexpectedTypeException ($ name , 'string or null ' );
779781 }
780782
781783 if (!self ::isValidName ($ name )) {
0 commit comments