Skip to content

Commit 3e82fcc

Browse files
committed
[Form] remove validation of FormRegistry::getType as FormRegistry::hasType does not validate either
also developers do not work with the registry directly anyway but through the factory. and the factory already validates the value.
1 parent 27249cf commit 3e82fcc

File tree

3 files changed

+0
-25
lines changed

3 files changed

+0
-25
lines changed

FormRegistry.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ public function __construct(array $extensions, ResolvedFormTypeFactoryInterface
6969
*/
7070
public function getType($name)
7171
{
72-
if (!is_string($name)) {
73-
throw new UnexpectedTypeException($name, 'string');
74-
}
75-
7672
if (!isset($this->types[$name])) {
7773
$type = null;
7874

FormRegistryInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ interface FormRegistryInterface
2727
*
2828
* @return ResolvedFormTypeInterface The type
2929
*
30-
* @throws Exception\UnexpectedTypeException if the passed name is not a string
3130
* @throws Exception\InvalidArgumentException if the type can not be retrieved from any extension
3231
*/
3332
public function getType($name);

Tests/FormRegistryTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,6 @@ public function testGetTypeConnectsParentIfGetParentReturnsInstance()
172172
$this->assertSame($resolvedType, $this->registry->getType('foo_sub_type_parent_instance'));
173173
}
174174

175-
/**
176-
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
177-
*/
178-
public function testGetTypeThrowsExceptionIfParentNotFound()
179-
{
180-
$type = new FooSubType();
181-
182-
$this->extension1->addType($type);
183-
184-
$this->registry->getType($type);
185-
}
186-
187175
/**
188176
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
189177
*/
@@ -192,14 +180,6 @@ public function testGetTypeThrowsExceptionIfTypeNotFound()
192180
$this->registry->getType('bar');
193181
}
194182

195-
/**
196-
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
197-
*/
198-
public function testGetTypeThrowsExceptionIfNoString()
199-
{
200-
$this->registry->getType(array());
201-
}
202-
203183
public function testHasTypeAfterLoadingFromExtension()
204184
{
205185
$type = new FooType();

0 commit comments

Comments
 (0)