Skip to content

Commit

Permalink
[Form] update type of form $name arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jul 31, 2019
1 parent b0d5f05 commit 4e4e1eb
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 28 deletions.
5 changes: 2 additions & 3 deletions ButtonBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ public function __construct($name, array $options = [])
*
* 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
*/
Expand Down
2 changes: 1 addition & 1 deletion Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ public function add($child, $type = null, array $options = [])

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) {
Expand Down
2 changes: 1 addition & 1 deletion FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function add($child, $type = null, array $options = [])
}

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) {
Expand Down
10 changes: 4 additions & 6 deletions FormBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -34,9 +33,8 @@ public function add($child, $type = null, array $options = []);
/**
* 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
*/
Expand Down
10 changes: 4 additions & 6 deletions FormConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -787,15 +785,15 @@ public function getFormConfig()
/**
* 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
*/
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)) {
Expand Down
14 changes: 6 additions & 8 deletions FormFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ public function create($type = 'Symfony\Component\Form\Extension\Core\Type\FormT
*
* @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
*
Expand Down Expand Up @@ -79,10 +78,9 @@ public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Typ
/**
* 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
*
Expand Down
6 changes: 3 additions & 3 deletions FormInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public function getParent();
/**
* 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
*
Expand Down

0 comments on commit 4e4e1eb

Please sign in to comment.