Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d07a419

Browse filesBrowse files
committed
[Form] fix some docblocks and type checks
1 parent 3cfb558 commit d07a419
Copy full SHA for d07a419

File tree

Expand file treeCollapse file tree

6 files changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+7
-7
lines changed

‎src/Symfony/Component/Form/AbstractType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/AbstractType.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver)
5252
*/
5353
public function getBlockPrefix()
5454
{
55-
return StringUtil::fqcnToBlockPrefix(\get_class($this));
55+
return StringUtil::fqcnToBlockPrefix(\get_class($this)) ?: '';
5656
}
5757

5858
/**

‎src/Symfony/Component/Form/FormBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/FormBuilder.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
4040
/**
4141
* Creates a new form builder.
4242
*
43-
* @param string $name
43+
* @param string|int $name
4444
* @param string|null $dataClass
4545
* @param EventDispatcherInterface $dispatcher
4646
* @param FormFactoryInterface $factory

‎src/Symfony/Component/Form/FormFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/FormFactory.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extens
6767
$options['data'] = $data;
6868
}
6969

70-
if (!\is_string($type)) {
71-
throw new UnexpectedTypeException($type, 'string');
70+
if (!\is_string($type) && !\is_int($type)) {
71+
throw new UnexpectedTypeException($type, 'string|int');
7272
}
7373

7474
$type = $this->registry->getType($type);

‎src/Symfony/Component/Form/ResolvedFormType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ResolvedFormType.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function getOptionsResolver()
204204
*
205205
* Override this method if you want to customize the builder class.
206206
*
207-
* @param string $name The name of the builder
207+
* @param string|int $name The name of the builder
208208
* @param string|null $dataClass The data class
209209
* @param FormFactoryInterface $factory The current form factory
210210
* @param array $options The builder options

‎src/Symfony/Component/Form/ResolvedFormTypeInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ResolvedFormTypeInterface.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getTypeExtensions();
5252
* Creates a new form builder for this type.
5353
*
5454
* @param FormFactoryInterface $factory The form factory
55-
* @param string $name The name for the builder
55+
* @param string|int $name The name for the builder
5656
* @param array $options The builder options
5757
*
5858
* @return FormBuilderInterface The created form builder

‎src/Symfony/Component/Form/Tests/FormFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/FormFactoryTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function testCreateNamedBuilderDoesNotOverrideExistingDataOption()
148148

149149
/**
150150
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
151-
* @expectedExceptionMessage Expected argument of type "string", "stdClass" given
151+
* @expectedExceptionMessage Expected argument of type "string|int", "stdClass" given
152152
*/
153153
public function testCreateNamedBuilderThrowsUnderstandableException()
154154
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.