Skip to content

Commit 545b374

Browse files
committed
Use ::class keyword when possible
1 parent 6b5f279 commit 545b374

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

Test/ConstraintValidatorTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected function createContext()
112112
{
113113
$translator = $this->getMockBuilder(TranslatorInterface::class)->getMock();
114114
$translator->expects($this->any())->method('trans')->willReturnArgument(0);
115-
$validator = $this->getMockBuilder('Symfony\Component\Validator\Validator\ValidatorInterface')->getMock();
115+
$validator = $this->getMockBuilder(\Symfony\Component\Validator\Validator\ValidatorInterface::class)->getMock();
116116
$validator->expects($this->any())
117117
->method('validate')
118118
->willReturnCallback(function () {

Tests/Constraints/AtLeastOneOfTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class AtLeastOneOfTest extends TestCase
2222
{
2323
public function testRejectNonConstraints()
2424
{
25-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
25+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
2626
new AtLeastOneOf([
2727
'foo',
2828
]);
2929
}
3030

3131
public function testRejectValidConstraint()
3232
{
33-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
33+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
3434
new AtLeastOneOf([
3535
new Valid(),
3636
]);

Tests/Constraints/LengthValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testEmptyStringIsInvalid()
5454

5555
public function testExpectsStringCompatibleType()
5656
{
57-
$this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
57+
$this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
5858
$this->validator->validate(new \stdClass(), new Length(['value' => 5]));
5959
}
6060

Tests/Constraints/LocaleValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testEmptyStringIsValid()
3838

3939
public function testExpectsStringCompatibleType()
4040
{
41-
$this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
41+
$this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
4242
$this->validator->validate(new \stdClass(), new Locale());
4343
}
4444

Tests/Constraints/UrlValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testEmptyStringFromObjectIsValid()
4545

4646
public function testExpectsStringCompatibleType()
4747
{
48-
$this->expectException('Symfony\Component\Validator\Exception\UnexpectedValueException');
48+
$this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
4949
$this->validator->validate(new \stdClass(), new Url());
5050
}
5151

Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ public function testCachedMetadata()
106106

107107
public function testNonClassNameStringValues()
108108
{
109-
$this->expectException('Symfony\Component\Validator\Exception\NoSuchMetadataException');
109+
$this->expectException(\Symfony\Component\Validator\Exception\NoSuchMetadataException::class);
110110
$testedValue = '[email protected]';
111-
$loader = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
111+
$loader = $this->getMockBuilder(LoaderInterface::class)->getMock();
112112
$cache = $this->createMock(CacheItemPoolInterface::class);
113113
$factory = new LazyLoadingMetadataFactory($loader, $cache);
114114
$cache

Tests/ValidatorBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function tearDown(): void
3535
public function testAddObjectInitializer()
3636
{
3737
$this->assertSame($this->builder, $this->builder->addObjectInitializer(
38-
$this->getMockBuilder('Symfony\Component\Validator\ObjectInitializerInterface')->getMock()
38+
$this->getMockBuilder(\Symfony\Component\Validator\ObjectInitializerInterface::class)->getMock()
3939
));
4040
}
4141

@@ -92,14 +92,14 @@ public function testSetMappingCache()
9292
public function testSetConstraintValidatorFactory()
9393
{
9494
$this->assertSame($this->builder, $this->builder->setConstraintValidatorFactory(
95-
$this->getMockBuilder('Symfony\Component\Validator\ConstraintValidatorFactoryInterface')->getMock())
95+
$this->getMockBuilder(\Symfony\Component\Validator\ConstraintValidatorFactoryInterface::class)->getMock())
9696
);
9797
}
9898

9999
public function testSetTranslator()
100100
{
101101
$this->assertSame($this->builder, $this->builder->setTranslator(
102-
$this->getMockBuilder('Symfony\Contracts\Translation\TranslatorInterface')->getMock())
102+
$this->getMockBuilder(\Symfony\Contracts\Translation\TranslatorInterface::class)->getMock())
103103
);
104104
}
105105

@@ -110,6 +110,6 @@ public function testSetTranslationDomain()
110110

111111
public function testGetValidator()
112112
{
113-
$this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator());
113+
$this->assertInstanceOf(\Symfony\Component\Validator\Validator\RecursiveValidator::class, $this->builder->getValidator());
114114
}
115115
}

0 commit comments

Comments
 (0)