Skip to content

Commit 2b9e693

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: Use ::class keyword when possible
2 parents 41e50bd + 057d034 commit 2b9e693

17 files changed

+85
-85
lines changed

Tests/Collator/CollatorTest.php

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

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

3636
public function testGetAttribute()
3737
{
38-
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
38+
$this->expectException(MethodNotImplementedException::class);
3939
$collator = $this->getCollator('en');
4040
$collator->getAttribute(Collator::NUMERIC_COLLATION);
4141
}
@@ -80,14 +80,14 @@ public function testGetStrength()
8080

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

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

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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';

Tests/DateFormatter/IntlDateFormatterTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testConstructorWithoutCalendar()
3939

4040
public function testConstructorWithUnsupportedLocale()
4141
{
42-
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
42+
$this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
4343
$this->getDateFormatter('pt_BR', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
4444
}
4545

@@ -69,23 +69,23 @@ public function testFormatWithUnsupportedTimestampArgument()
6969
try {
7070
$formatter->format($localtime);
7171
} catch (\Exception $e) {
72-
$this->assertInstanceOf('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException', $e);
72+
$this->assertInstanceOf(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class, $e);
7373

7474
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
7575
}
7676
}
7777

7878
public function testFormatWithUnimplementedChars()
7979
{
80-
$this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
80+
$this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
8181
$pattern = 'Y';
8282
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, $pattern);
8383
$formatter->format(0);
8484
}
8585

8686
public function testFormatWithNonIntegerTimestamp()
8787
{
88-
$this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
88+
$this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
8989
$formatter = $this->getDefaultDateFormatter();
9090
$formatter->format([]);
9191
}
@@ -110,42 +110,42 @@ public function testIsLenient()
110110

111111
public function testLocaltime()
112112
{
113-
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
113+
$this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
114114
$formatter = $this->getDefaultDateFormatter();
115115
$formatter->localtime('Wednesday, December 31, 1969 4:00:00 PM PT');
116116
}
117117

118118
public function testParseWithNotNullPositionValue()
119119
{
120-
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException');
120+
$this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException::class);
121121
$position = 0;
122122
$formatter = $this->getDefaultDateFormatter('y');
123123
$this->assertSame(0, $formatter->parse('1970', $position));
124124
}
125125

126126
public function testSetCalendar()
127127
{
128-
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
128+
$this->expectException(\Symfony\Component\Intl\Exception\MethodNotImplementedException::class);
129129
$formatter = $this->getDefaultDateFormatter();
130130
$formatter->setCalendar(IntlDateFormatter::GREGORIAN);
131131
}
132132

133133
public function testSetLenient()
134134
{
135-
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
135+
$this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
136136
$formatter = $this->getDefaultDateFormatter();
137137
$formatter->setLenient(true);
138138
}
139139

140140
public function testFormatWithGmtTimeZoneAndMinutesOffset()
141141
{
142-
$this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
142+
$this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
143143
parent::testFormatWithGmtTimeZoneAndMinutesOffset();
144144
}
145145

146146
public function testFormatWithNonStandardTimezone()
147147
{
148-
$this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
148+
$this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
149149
parent::testFormatWithNonStandardTimezone();
150150
}
151151

Tests/LanguagesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,13 +1690,13 @@ function ($value) { return [$value]; },
16901690
*/
16911691
public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($language)
16921692
{
1693-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
1693+
$this->expectException(MissingResourceException::class);
16941694
Languages::getAlpha3Code($language);
16951695
}
16961696

16971697
public function testGetNameWithInvalidLanguageCode()
16981698
{
1699-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
1699+
$this->expectException(MissingResourceException::class);
17001700
Languages::getName('foo');
17011701
}
17021702

@@ -1740,7 +1740,7 @@ function ($value) { return [$value]; },
17401740
*/
17411741
public function testGetAlpha2CodeFailsIfNoAlpha2Equivalent($language)
17421742
{
1743-
$this->expectException('Symfony\Component\Intl\Exception\MissingResourceException');
1743+
$this->expectException(MissingResourceException::class);
17441744
Languages::getAlpha2Code($language);
17451745
}
17461746

0 commit comments

Comments
 (0)