Skip to content

Commit 718252b

Browse files
committed
Use ::class keyword when possible
1 parent 27da557 commit 718252b

20 files changed

+93
-93
lines changed

Tests/Collator/CollatorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ class CollatorTest extends AbstractCollatorTest
1919
{
2020
public function testConstructorWithUnsupportedLocale()
2121
{
22-
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
22+
$this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
2323
$this->getCollator('pt_BR');
2424
}
2525

2626
public function testCompare()
2727
{
28-
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
28+
$this->expectException(MethodNotImplementedException::class);
2929
$collator = $this->getCollator('en');
3030
$collator->compare('a', 'b');
3131
}
3232

3333
public function testGetAttribute()
3434
{
35-
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
35+
$this->expectException(MethodNotImplementedException::class);
3636
$collator = $this->getCollator('en');
3737
$collator->getAttribute(Collator::NUMERIC_COLLATION);
3838
}
@@ -77,14 +77,14 @@ public function testGetStrength()
7777

7878
public function testSetAttribute()
7979
{
80-
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
80+
$this->expectException(MethodNotImplementedException::class);
8181
$collator = $this->getCollator('en');
8282
$collator->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON);
8383
}
8484

8585
public function testSetStrength()
8686
{
87-
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
87+
$this->expectException(MethodNotImplementedException::class);
8888
$collator = $this->getCollator('en');
8989
$collator->setStrength(Collator::PRIMARY);
9090
}

Tests/CountriesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ public function testLocaleAliasesAreLoaded()
592592

593593
public function testGetNameWithInvalidCountryCode()
594594
{
595-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
595+
$this->expectException(MissingResourceException::class);
596596
Countries::getName('foo');
597597
}
598598

Tests/CurrenciesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ function ($value) { return [$value]; },
725725
*/
726726
public function testGetNumericCodeFailsIfNoNumericEquivalent($currency)
727727
{
728-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
728+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
729729
Currencies::getNumericCode($currency);
730730
}
731731

@@ -770,13 +770,13 @@ function ($value) { return [$value]; },
770770
*/
771771
public function testForNumericCodeFailsIfInvalidNumericCode($currency)
772772
{
773-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
773+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
774774
Currencies::forNumericCode($currency);
775775
}
776776

777777
public function testGetNameWithInvalidCurrencyCode()
778778
{
779-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
779+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
780780
Currencies::getName('foo');
781781
}
782782

Tests/Data/Bundle/Reader/BundleEntryReaderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class BundleEntryReaderTest extends TestCase
6464

6565
protected function setUp(): void
6666
{
67-
$this->readerImpl = $this->getMockBuilder('Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface')->getMock();
67+
$this->readerImpl = $this->getMockBuilder(\Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface::class)->getMock();
6868
$this->reader = new BundleEntryReader($this->readerImpl);
6969
}
7070

@@ -103,7 +103,7 @@ public function testReadExistingEntry()
103103

104104
public function testReadNonExistingEntry()
105105
{
106-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
106+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
107107
$this->readerImpl->expects($this->once())
108108
->method('read')
109109
->with(self::RES_DIR, 'root')
@@ -127,7 +127,7 @@ public function testFallbackIfEntryDoesNotExist()
127127

128128
public function testDontFallbackIfEntryDoesNotExistAndFallbackDisabled()
129129
{
130-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
130+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
131131
$this->readerImpl->expects($this->once())
132132
->method('read')
133133
->with(self::RES_DIR, 'en_GB')
@@ -154,7 +154,7 @@ public function testFallbackIfLocaleDoesNotExist()
154154

155155
public function testDontFallbackIfLocaleDoesNotExistAndFallbackDisabled()
156156
{
157-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
157+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
158158
$this->readerImpl->expects($this->once())
159159
->method('read')
160160
->with(self::RES_DIR, 'en_GB')
@@ -279,7 +279,7 @@ public function testMergeExistingEntryWithNonExistingFallbackEntry($childData, $
279279

280280
public function testFailIfEntryFoundNeitherInParentNorChild()
281281
{
282-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
282+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
283283
$this->readerImpl
284284
->method('read')
285285
->withConsecutive(

Tests/Data/Bundle/Reader/IntlBundleReaderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testReadDoesNotFollowFallbackAlias()
6666
// "mo" = "ro_MD" -> "ro"
6767
$data = $this->reader->read(__DIR__.'/Fixtures/res', 'mo');
6868

69-
$this->assertInstanceOf('\ArrayAccess', $data);
69+
$this->assertInstanceOf(\ArrayAccess::class, $data);
7070
$this->assertSame('Bam', $data['Baz'], 'data from the aliased locale can be accessed');
7171
$this->assertArrayNotHasKey('Foo', $data);
7272
$this->assertNull($data['Foo']);
@@ -75,19 +75,19 @@ public function testReadDoesNotFollowFallbackAlias()
7575

7676
public function testReadFailsIfNonExistingLocale()
7777
{
78-
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
78+
$this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
7979
$this->reader->read(__DIR__.'/Fixtures/res', 'foo');
8080
}
8181

8282
public function testReadFailsIfNonExistingFallbackLocale()
8383
{
84-
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
84+
$this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
8585
$this->reader->read(__DIR__.'/Fixtures/res', 'ro_AT');
8686
}
8787

8888
public function testReadFailsIfNonExistingDirectory()
8989
{
90-
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
90+
$this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
9191
$this->reader->read(__DIR__.'/foo', 'ro');
9292
}
9393
}

Tests/Data/Bundle/Reader/JsonBundleReaderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,31 @@ public function testReadReturnsArray()
4040

4141
public function testReadFailsIfNonExistingLocale()
4242
{
43-
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
43+
$this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
4444
$this->reader->read(__DIR__.'/Fixtures/json', 'foo');
4545
}
4646

4747
public function testReadFailsIfNonExistingDirectory()
4848
{
49-
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
49+
$this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
5050
$this->reader->read(__DIR__.'/foo', 'en');
5151
}
5252

5353
public function testReadFailsIfNotAFile()
5454
{
55-
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
55+
$this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
5656
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
5757
}
5858

5959
public function testReadFailsIfInvalidJson()
6060
{
61-
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
61+
$this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
6262
$this->reader->read(__DIR__.'/Fixtures/json', 'en_Invalid');
6363
}
6464

6565
public function testReaderDoesNotBreakOutOfGivenPath()
6666
{
67-
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
67+
$this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
6868
$this->reader->read(__DIR__.'/Fixtures/json', '../invalid_directory/en');
6969
}
7070
}

Tests/Data/Bundle/Reader/PhpBundleReaderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@ public function testReadReturnsArray()
4040

4141
public function testReadFailsIfNonExistingLocale()
4242
{
43-
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
43+
$this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
4444
$this->reader->read(__DIR__.'/Fixtures/php', 'foo');
4545
}
4646

4747
public function testReadFailsIfNonExistingDirectory()
4848
{
49-
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
49+
$this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
5050
$this->reader->read(__DIR__.'/foo', 'en');
5151
}
5252

5353
public function testReadFailsIfNotAFile()
5454
{
55-
$this->expectException('Symfony\Component\Intl\Exception\RuntimeException');
55+
$this->expectException(\Symfony\Component\Intl\Exception\RuntimeException::class);
5656
$this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en');
5757
}
5858

5959
public function testReaderDoesNotBreakOutOfGivenPath()
6060
{
61-
$this->expectException('Symfony\Component\Intl\Exception\ResourceBundleNotFoundException');
61+
$this->expectException(\Symfony\Component\Intl\Exception\ResourceBundleNotFoundException::class);
6262
$this->reader->read(__DIR__.'/Fixtures/php', '../invalid_directory/en');
6363
}
6464
}

Tests/Data/Provider/AbstractCurrencyDataProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function ($value) { return [$value]; },
758758
*/
759759
public function testGetNumericCodeFailsIfNoNumericEquivalent($currency)
760760
{
761-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
761+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
762762
$this->dataProvider->getNumericCode($currency);
763763
}
764764

@@ -803,7 +803,7 @@ function ($value) { return [$value]; },
803803
*/
804804
public function testForNumericCodeFailsIfInvalidNumericCode($currency)
805805
{
806-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
806+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
807807
$this->dataProvider->forNumericCode($currency);
808808
}
809809

Tests/Data/Provider/AbstractLanguageDataProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ function ($value) { return [$value]; },
924924
*/
925925
public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($currency)
926926
{
927-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
927+
$this->expectException(\Symfony\Component\Intl\Exception\MissingResourceException::class);
928928
$this->dataProvider->getAlpha3Code($currency);
929929
}
930930
}

Tests/Data/Util/RingBufferTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testWritePastBuffer()
5454

5555
public function testReadNonExistingFails()
5656
{
57-
$this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
57+
$this->expectException(\Symfony\Component\Intl\Exception\OutOfBoundsException::class);
5858
$this->buffer['foo'];
5959
}
6060

@@ -72,7 +72,7 @@ public function testUnsetNonExistingSucceeds()
7272

7373
public function testReadOverwrittenFails()
7474
{
75-
$this->expectException('Symfony\Component\Intl\Exception\OutOfBoundsException');
75+
$this->expectException(\Symfony\Component\Intl\Exception\OutOfBoundsException::class);
7676
$this->buffer[0] = 'foo';
7777
$this->buffer['bar'] = 'baz';
7878
$this->buffer[2] = 'bam';

0 commit comments

Comments
 (0)