Skip to content

Commit 057d034

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Use ::class keyword when possible
2 parents 2fee131 + 718252b commit 057d034

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
@@ -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: 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
@@ -36,7 +36,7 @@ public function testConstructorWithoutCalendar()
3636

3737
public function testConstructorWithUnsupportedLocale()
3838
{
39-
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
39+
$this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
4040
$this->getDateFormatter('pt_BR', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
4141
}
4242

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

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

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

8383
public function testFormatWithNonIntegerTimestamp()
8484
{
85-
$this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
85+
$this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
8686
$formatter = $this->getDefaultDateFormatter();
8787
$formatter->format([]);
8888
}
@@ -107,42 +107,42 @@ public function testIsLenient()
107107

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

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

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

130130
public function testSetLenient()
131131
{
132-
$this->expectException('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException');
132+
$this->expectException(\Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException::class);
133133
$formatter = $this->getDefaultDateFormatter();
134134
$formatter->setLenient(true);
135135
}
136136

137137
public function testFormatWithGmtTimeZoneAndMinutesOffset()
138138
{
139-
$this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
139+
$this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
140140
parent::testFormatWithGmtTimeZoneAndMinutesOffset();
141141
}
142142

143143
public function testFormatWithNonStandardTimezone()
144144
{
145-
$this->expectException('Symfony\Component\Intl\Exception\NotImplementedException');
145+
$this->expectException(\Symfony\Component\Intl\Exception\NotImplementedException::class);
146146
parent::testFormatWithNonStandardTimezone();
147147
}
148148

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)