[Form] update type of form $name arguments
This commit is contained in:
parent
3f431860c6
commit
6d4dcadd66
@ -71,9 +71,8 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
|
|||||||
*
|
*
|
||||||
* This method should not be invoked.
|
* This method should not be invoked.
|
||||||
*
|
*
|
||||||
* @param string|int|FormBuilderInterface $child
|
* @param string|FormBuilderInterface $child
|
||||||
* @param string|FormTypeInterface $type
|
* @param string|FormTypeInterface $type
|
||||||
* @param array $options
|
|
||||||
*
|
*
|
||||||
* @throws BadMethodCallException
|
* @throws BadMethodCallException
|
||||||
*/
|
*/
|
||||||
|
@ -819,7 +819,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
|
|
||||||
if (!$child instanceof FormInterface) {
|
if (!$child instanceof FormInterface) {
|
||||||
if (!\is_string($child) && !\is_int($child)) {
|
if (!\is_string($child) && !\is_int($child)) {
|
||||||
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormInterface');
|
throw new UnexpectedTypeException($child, 'string or Symfony\Component\Form\FormInterface');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
|
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
|
||||||
|
@ -70,7 +70,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_string($child) && !\is_int($child)) {
|
if (!\is_string($child) && !\is_int($child)) {
|
||||||
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilderInterface');
|
throw new UnexpectedTypeException($child, 'string or Symfony\Component\Form\FormBuilderInterface');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
|
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
|
||||||
|
@ -23,9 +23,8 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
|
|||||||
* If you add a nested group, this group should also be represented in the
|
* If you add a nested group, this group should also be represented in the
|
||||||
* object hierarchy.
|
* object hierarchy.
|
||||||
*
|
*
|
||||||
* @param string|int|FormBuilderInterface $child
|
* @param string|FormBuilderInterface $child
|
||||||
* @param string|null $type
|
* @param string|null $type
|
||||||
* @param array $options
|
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
@ -36,7 +35,6 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
|
|||||||
*
|
*
|
||||||
* @param string $name The name of the form or the name of the property
|
* @param string $name The name of the form or the name of the property
|
||||||
* @param string|null $type The type of the form or null if name is a property
|
* @param string|null $type The type of the form or null if name is a property
|
||||||
* @param array $options The options
|
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
|
@ -121,10 +121,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
/**
|
/**
|
||||||
* Creates an empty form configuration.
|
* Creates an empty form configuration.
|
||||||
*
|
*
|
||||||
* @param string|int $name The form name
|
* @param string $name The form name
|
||||||
* @param string|null $dataClass The class of the form's data
|
* @param string|null $dataClass The class of the form's data
|
||||||
* @param EventDispatcherInterface $dispatcher The event dispatcher
|
|
||||||
* @param array $options The form options
|
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException if the data class is not a valid class or if
|
* @throws InvalidArgumentException if the data class is not a valid class or if
|
||||||
* the name contains invalid characters
|
* the name contains invalid characters
|
||||||
@ -787,7 +785,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
/**
|
/**
|
||||||
* Validates whether the given variable is a valid form name.
|
* Validates whether the given variable is a valid form name.
|
||||||
*
|
*
|
||||||
* @param string|int|null $name The tested form name
|
* @param string|null $name The tested form name
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException if the name is not a string or an integer
|
* @throws UnexpectedTypeException if the name is not a string or an integer
|
||||||
* @throws InvalidArgumentException if the name contains invalid characters
|
* @throws InvalidArgumentException if the name contains invalid characters
|
||||||
@ -795,7 +793,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
public static function validateName($name)
|
public static function validateName($name)
|
||||||
{
|
{
|
||||||
if (null !== $name && !\is_string($name) && !\is_int($name)) {
|
if (null !== $name && !\is_string($name) && !\is_int($name)) {
|
||||||
throw new UnexpectedTypeException($name, 'string, integer or null');
|
throw new UnexpectedTypeException($name, 'string or null');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::isValidName($name)) {
|
if (!self::isValidName($name)) {
|
||||||
|
@ -36,10 +36,9 @@ interface FormFactoryInterface
|
|||||||
*
|
*
|
||||||
* @see createNamedBuilder()
|
* @see createNamedBuilder()
|
||||||
*
|
*
|
||||||
* @param string|int $name The name of the form
|
* @param string $name The name of the form
|
||||||
* @param string $type The type of the form
|
* @param string $type The type of the form
|
||||||
* @param mixed $data The initial data
|
* @param mixed $data The initial data
|
||||||
* @param array $options The options
|
|
||||||
*
|
*
|
||||||
* @return FormInterface The form
|
* @return FormInterface The form
|
||||||
*
|
*
|
||||||
@ -79,10 +78,9 @@ interface FormFactoryInterface
|
|||||||
/**
|
/**
|
||||||
* Returns a form builder.
|
* Returns a form builder.
|
||||||
*
|
*
|
||||||
* @param string|int $name The name of the form
|
* @param string $name The name of the form
|
||||||
* @param string $type The type of the form
|
* @param string $type The type of the form
|
||||||
* @param mixed $data The initial data
|
* @param mixed $data The initial data
|
||||||
* @param array $options The options
|
|
||||||
*
|
*
|
||||||
* @return FormBuilderInterface The form builder
|
* @return FormBuilderInterface The form builder
|
||||||
*
|
*
|
||||||
|
@ -43,7 +43,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
/**
|
/**
|
||||||
* Adds or replaces a child to the form.
|
* Adds or replaces a child to the form.
|
||||||
*
|
*
|
||||||
* @param FormInterface|string|int $child The FormInterface instance or the name of the child
|
* @param FormInterface|string $child The FormInterface instance or the name of the child
|
||||||
* @param string|null $type The child's type, if a name was passed
|
* @param string|null $type The child's type, if a name was passed
|
||||||
* @param array $options The child's options, if a name was passed
|
* @param array $options The child's options, if a name was passed
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user