Skip to content

Commit 72388f6

Browse files
committed
Use ::class keyword when possible
1 parent 315eac2 commit 72388f6

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Tests/Constraints/BicValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testThrowsConstraintExceptionIfBothValueAndPropertyPath()
160160
*/
161161
public function testThrowsConstraintExceptionIfBothValueAndPropertyPathNamed()
162162
{
163-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
163+
$this->expectException(ConstraintDefinitionException::class);
164164
$this->expectExceptionMessage('The "iban" and "ibanPropertyPath" options of the Iban constraint cannot be used at the same time');
165165

166166
eval('new \Symfony\Component\Validator\Constraints\Bic(iban: "value", ibanPropertyPath: "propertyPath");');

Tests/Constraints/RangeTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class RangeTest extends TestCase
1212

1313
public function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPath()
1414
{
15-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
15+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
1616
$this->expectExceptionMessage('requires only one of the "min" or "minPropertyPath" options to be set, not both.');
1717
new Range([
1818
'min' => 'min',
@@ -25,14 +25,14 @@ public function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPath()
2525
*/
2626
public function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPathNamed()
2727
{
28-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
28+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
2929
$this->expectExceptionMessage('requires only one of the "min" or "minPropertyPath" options to be set, not both.');
3030
eval('new \Symfony\Component\Validator\Constraints\Range(min: "min", minPropertyPath: "minPropertyPath");');
3131
}
3232

3333
public function testThrowsConstraintExceptionIfBothMaxLimitAndPropertyPath()
3434
{
35-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
35+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
3636
$this->expectExceptionMessage('requires only one of the "max" or "maxPropertyPath" options to be set, not both.');
3737
new Range([
3838
'max' => 'max',
@@ -45,14 +45,14 @@ public function testThrowsConstraintExceptionIfBothMaxLimitAndPropertyPath()
4545
*/
4646
public function testThrowsConstraintExceptionIfBothMaxLimitAndPropertyPathNamed()
4747
{
48-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
48+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
4949
$this->expectExceptionMessage('requires only one of the "max" or "maxPropertyPath" options to be set, not both.');
5050
eval('new \Symfony\Component\Validator\Constraints\Range(max: "max", maxPropertyPath: "maxPropertyPath");');
5151
}
5252

5353
public function testThrowsConstraintExceptionIfNoLimitNorPropertyPath()
5454
{
55-
$this->expectException('Symfony\Component\Validator\Exception\MissingOptionsException');
55+
$this->expectException(\Symfony\Component\Validator\Exception\MissingOptionsException::class);
5656
$this->expectExceptionMessage('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given');
5757
new Range([]);
5858
}

Tests/Mapping/GetterMetadataTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GetterMetadataTest extends TestCase
2121

2222
public function testInvalidPropertyName()
2323
{
24-
$this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
24+
$this->expectException(\Symfony\Component\Validator\Exception\ValidatorException::class);
2525

2626
new GetterMetadata(self::CLASSNAME, 'foobar');
2727
}
@@ -63,7 +63,7 @@ public function testGetPropertyValueFromHasser()
6363

6464
public function testUndefinedMethodNameThrowsException()
6565
{
66-
$this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
66+
$this->expectException(\Symfony\Component\Validator\Exception\ValidatorException::class);
6767
$this->expectExceptionMessage('The "hasLastName()" method does not exist in class "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity".');
6868
new GetterMetadata(self::CLASSNAME, 'lastName', 'hasLastName');
6969
}

0 commit comments

Comments
 (0)