[Form] update type of form $name arguments

This commit is contained in:
Nicolas Grekas 2019-07-31 13:39:02 +02:00
parent 3f431860c6
commit 6d4dcadd66
7 changed files with 21 additions and 28 deletions

View File

@ -71,9 +71,8 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*
* This method should not be invoked.
*
* @param string|int|FormBuilderInterface $child
* @param string|FormTypeInterface $type
* @param array $options
* @param string|FormBuilderInterface $child
* @param string|FormTypeInterface $type
*
* @throws BadMethodCallException
*/

View File

@ -819,7 +819,7 @@ class Form implements \IteratorAggregate, FormInterface
if (!$child instanceof FormInterface) {
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) {

View File

@ -70,7 +70,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
}
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) {

View File

@ -23,9 +23,8 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
* If you add a nested group, this group should also be represented in the
* object hierarchy.
*
* @param string|int|FormBuilderInterface $child
* @param string|null $type
* @param array $options
* @param string|FormBuilderInterface $child
* @param string|null $type
*
* @return self
*/
@ -34,9 +33,8 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
/**
* Creates a form builder.
*
* @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 array $options The options
* @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
*
* @return self
*/

View File

@ -121,10 +121,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
/**
* Creates an empty form configuration.
*
* @param string|int $name The form name
* @param string|null $dataClass The class of the form's data
* @param EventDispatcherInterface $dispatcher The event dispatcher
* @param array $options The form options
* @param string $name The form name
* @param string|null $dataClass The class of the form's data
*
* @throws InvalidArgumentException if the data class is not a valid class or if
* the name contains invalid characters
@ -787,7 +785,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
/**
* 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 InvalidArgumentException if the name contains invalid characters
@ -795,7 +793,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
public static function validateName($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)) {

View File

@ -36,10 +36,9 @@ interface FormFactoryInterface
*
* @see createNamedBuilder()
*
* @param string|int $name The name of the form
* @param string $type The type of the form
* @param mixed $data The initial data
* @param array $options The options
* @param string $name The name of the form
* @param string $type The type of the form
* @param mixed $data The initial data
*
* @return FormInterface The form
*
@ -79,10 +78,9 @@ interface FormFactoryInterface
/**
* Returns a form builder.
*
* @param string|int $name The name of the form
* @param string $type The type of the form
* @param mixed $data The initial data
* @param array $options The options
* @param string $name The name of the form
* @param string $type The type of the form
* @param mixed $data The initial data
*
* @return FormBuilderInterface The form builder
*

View File

@ -43,9 +43,9 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
/**
* Adds or replaces a child to the form.
*
* @param FormInterface|string|int $child The FormInterface instance or the name of the child
* @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 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 array $options The child's options, if a name was passed
*
* @return $this
*