Skip to content

Commit 6781e53

Browse files
committed
minor symfony#24876 Remove some unneeded checks/tests (nicolas-grekas)
This PR was merged into the 4.0-dev branch. Discussion ---------- Remove some unneeded checks/tests | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As spotted by @Tobion in symfony#24722 (review) Commits ------- 05681ec Remove some unneeded checks/tests
2 parents 2fb303b + 05681ec commit 6781e53

File tree

9 files changed

+0
-133
lines changed

9 files changed

+0
-133
lines changed

src/Symfony/Component/Form/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

src/Symfony/Component/Form/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
{

src/Symfony/Component/Form/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
{

src/Symfony/Component/Form/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
*/

src/Symfony/Component/PropertyAccess/Tests/Fixtures/ReturnTyped.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassTypeErrorInsideCall.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1616
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
1717
use Symfony\Component\PropertyAccess\PropertyAccessor;
18-
use Symfony\Component\PropertyAccess\Tests\Fixtures\ReturnTyped;
1918
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClass;
2019
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
2120
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet;
2221
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object;
2322
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassSetValue;
2423
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassIsWritable;
25-
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassTypeErrorInsideCall;
2624
use Symfony\Component\PropertyAccess\Tests\Fixtures\TypeHinted;
2725

2826
class PropertyAccessorTest extends TestCase
@@ -634,24 +632,4 @@ public function setFoo($foo)
634632

635633
return $obj;
636634
}
637-
638-
/**
639-
* @expectedException \TypeError
640-
*/
641-
public function testThrowTypeErrorInsideSetterCall()
642-
{
643-
$object = new TestClassTypeErrorInsideCall();
644-
645-
$this->propertyAccessor->setValue($object, 'property', 'foo');
646-
}
647-
648-
/**
649-
* @expectedException \TypeError
650-
*/
651-
public function testDoNotDiscardReturnTypeError()
652-
{
653-
$object = new ReturnTyped();
654-
655-
$this->propertyAccessor->setValue($object, 'foos', array(new \DateTime()));
656-
}
657635
}

src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,6 @@ public function testConstructor()
2929
$this->assertTrue($token->isAuthenticated());
3030
}
3131

32-
/**
33-
* @expectedException \TypeError
34-
*/
35-
public function testConstructorSecretCannotBeNull()
36-
{
37-
new RememberMeToken(
38-
$this->getUser(),
39-
null,
40-
null
41-
);
42-
}
43-
4432
/**
4533
* @expectedException \InvalidArgumentException
4634
*/

src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,6 @@ public function testStartTime()
154154
$this->assertEquals(0, $event->getStartTime(), null, self::DELTA);
155155
}
156156

157-
/**
158-
* @expectedException \TypeError
159-
*/
160-
public function testInvalidOriginThrowsAnException()
161-
{
162-
new StopwatchEvent('abc');
163-
}
164-
165157
public function testHumanRepresentation()
166158
{
167159
$event = new StopwatchEvent(microtime(true) * 1000);

0 commit comments

Comments
 (0)