Skip to content

Commit dfde9f1

Browse files
Remove some unneeded checks/tests
1 parent 39f7b99 commit dfde9f1

File tree

4 files changed

+0
-32
lines changed

4 files changed

+0
-32
lines changed

Extension/Core/DataTransformer/BaseDateTimeTransformer.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Form\DataTransformerInterface;
1515
use Symfony\Component\Form\Exception\InvalidArgumentException;
16-
use Symfony\Component\Form\Exception\UnexpectedTypeException;
1716

1817
abstract class BaseDateTimeTransformer implements DataTransformerInterface
1918
{
@@ -33,19 +32,10 @@ abstract class BaseDateTimeTransformer implements DataTransformerInterface
3332
* @param string $inputTimezone The name of the input timezone
3433
* @param string $outputTimezone The name of the output timezone
3534
*
36-
* @throws UnexpectedTypeException if a timezone is not a string
3735
* @throws InvalidArgumentException if a timezone is not valid
3836
*/
3937
public function __construct(string $inputTimezone = null, string $outputTimezone = null)
4038
{
41-
if (null !== $inputTimezone && !is_string($inputTimezone)) {
42-
throw new UnexpectedTypeException($inputTimezone, 'string');
43-
}
44-
45-
if (null !== $outputTimezone && !is_string($outputTimezone)) {
46-
throw new UnexpectedTypeException($outputTimezone, 'string');
47-
}
48-
4939
$this->inputTimezone = $inputTimezone ?: date_default_timezone_get();
5040
$this->outputTimezone = $outputTimezone ?: date_default_timezone_get();
5141

Extension/Core/DataTransformer/DateTimeToArrayTransformer.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
1313

1414
use Symfony\Component\Form\Exception\TransformationFailedException;
15-
use Symfony\Component\Form\Exception\UnexpectedTypeException;
1615

1716
/**
1817
* Transforms between a normalized time and a localized time string/array.
@@ -31,8 +30,6 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
3130
* @param string $outputTimezone The output timezone
3231
* @param array $fields The date fields
3332
* @param bool $pad Whether to use padding
34-
*
35-
* @throws UnexpectedTypeException if a timezone is not a string
3633
*/
3734
public function __construct(string $inputTimezone = null, string $outputTimezone = null, array $fields = null, bool $pad = false)
3835
{

Extension/Core/DataTransformer/DateTimeToStringTransformer.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
1313

1414
use Symfony\Component\Form\Exception\TransformationFailedException;
15-
use Symfony\Component\Form\Exception\UnexpectedTypeException;
1615

1716
/**
1817
* Transforms between a date string and a DateTime object.
@@ -48,8 +47,6 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
4847
* @param string $inputTimezone The name of the input timezone
4948
* @param string $outputTimezone The name of the output timezone
5049
* @param string $format The date format
51-
*
52-
* @throws UnexpectedTypeException if a timezone is not a string
5350
*/
5451
public function __construct(string $inputTimezone = null, string $outputTimezone = null, string $format = 'Y-m-d H:i:s')
5552
{

Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -306,22 +306,6 @@ public function testReverseTransformWrapsIntlErrors()
306306
$transformer->reverseTransform('12345');
307307
}
308308

309-
/**
310-
* @expectedException \TypeError
311-
*/
312-
public function testValidateDateFormatOption()
313-
{
314-
new DateTimeToLocalizedStringTransformer(null, null, 'foobar');
315-
}
316-
317-
/**
318-
* @expectedException \TypeError
319-
*/
320-
public function testValidateTimeFormatOption()
321-
{
322-
new DateTimeToLocalizedStringTransformer(null, null, null, 'foobar');
323-
}
324-
325309
/**
326310
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
327311
*/

0 commit comments

Comments
 (0)