Skip to content

Commit b1a42fa

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: Use ::class keyword when possible
2 parents e2ee066 + 8c5e45d commit b1a42fa

25 files changed

+64
-64
lines changed

Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ private function setPhpDefaultLocale(string $locale): void
20002000
// setting the default locale, the intl module is not installed, and
20012001
// the call can be ignored:
20022002
try {
2003-
if (class_exists('Locale', false)) {
2003+
if (class_exists(\Locale::class, false)) {
20042004
\Locale::setDefault($locale);
20052005
}
20062006
} catch (\Exception $e) {

Tests/BinaryFileResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testConstructWithNonAsciiFilename()
7171

7272
public function testSetContent()
7373
{
74-
$this->expectException('LogicException');
74+
$this->expectException(\LogicException::class);
7575
$response = new BinaryFileResponse(__FILE__);
7676
$response->setContent('foo');
7777
}

Tests/CookieTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function namesWithSpecialCharacters()
4343
*/
4444
public function testInstantiationThrowsExceptionIfRawCookieNameContainsSpecialCharacters($name)
4545
{
46-
$this->expectException('InvalidArgumentException');
46+
$this->expectException(\InvalidArgumentException::class);
4747
Cookie::create($name, null, 0, null, null, null, false, true);
4848
}
4949

@@ -66,13 +66,13 @@ public function testInstantiationSucceedNonRawCookieNameContainsSpecialCharacter
6666

6767
public function testInstantiationThrowsExceptionIfCookieNameIsEmpty()
6868
{
69-
$this->expectException('InvalidArgumentException');
69+
$this->expectException(\InvalidArgumentException::class);
7070
Cookie::create('');
7171
}
7272

7373
public function testInvalidExpiration()
7474
{
75-
$this->expectException('InvalidArgumentException');
75+
$this->expectException(\InvalidArgumentException::class);
7676
Cookie::create('MyCookie', 'foo', 'bar');
7777
}
7878

Tests/ExpressionRequestMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ExpressionRequestMatcherTest extends TestCase
2020
{
2121
public function testWhenNoExpressionIsSet()
2222
{
23-
$this->expectException('LogicException');
23+
$this->expectException(\LogicException::class);
2424
$expressionRequestMatcher = new ExpressionRequestMatcher();
2525
$expressionRequestMatcher->matches(new Request());
2626
}

Tests/File/FileTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testGuessExtensionIsBasedOnMimeType()
4141

4242
public function testConstructWhenFileNotExists()
4343
{
44-
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
44+
$this->expectException(\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException::class);
4545

4646
new File(__DIR__.'/Fixtures/not_here');
4747
}
@@ -57,7 +57,7 @@ public function testMove()
5757

5858
$file = new File($path);
5959
$movedFile = $file->move($targetDir);
60-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
60+
$this->assertInstanceOf(File::class, $movedFile);
6161

6262
$this->assertFileExists($targetPath);
6363
$this->assertFileDoesNotExist($path);
@@ -118,7 +118,7 @@ public function testMoveWithNonLatinName($filename, $sanitizedFilename)
118118

119119
$file = new File($path);
120120
$movedFile = $file->move($targetDir, $filename);
121-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile);
121+
$this->assertInstanceOf(File::class, $movedFile);
122122

123123
$this->assertFileExists($targetPath);
124124
$this->assertFileDoesNotExist($path);

Tests/File/UploadedFileTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function setUp(): void
3333

3434
public function testConstructWhenFileNotExists()
3535
{
36-
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
36+
$this->expectException(\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException::class);
3737

3838
new UploadedFile(
3939
__DIR__.'/Fixtures/not_here',
@@ -144,7 +144,7 @@ public function testGetClientOriginalExtension()
144144

145145
public function testMoveLocalFileIsNotAllowed()
146146
{
147-
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileException');
147+
$this->expectException(FileException::class);
148148
$file = new UploadedFile(
149149
__DIR__.'/Fixtures/test.gif',
150150
'original.gif',

Tests/FileBagTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class FileBagTest extends TestCase
2525
{
2626
public function testFileMustBeAnArrayOrUploadedFile()
2727
{
28-
$this->expectException('InvalidArgumentException');
28+
$this->expectException(\InvalidArgumentException::class);
2929
new FileBag(['file' => 'foo']);
3030
}
3131

Tests/HeaderBagTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testGetDate()
4545
{
4646
$bag = new HeaderBag(['foo' => 'Tue, 4 Sep 2012 20:00:00 +0200']);
4747
$headerDate = $bag->getDate('foo');
48-
$this->assertInstanceOf('DateTime', $headerDate);
48+
$this->assertInstanceOf(\DateTime::class, $headerDate);
4949
}
5050

5151
public function testGetDateNull()
@@ -57,7 +57,7 @@ public function testGetDateNull()
5757

5858
public function testGetDateException()
5959
{
60-
$this->expectException('RuntimeException');
60+
$this->expectException(\RuntimeException::class);
6161
$bag = new HeaderBag(['foo' => 'Tue']);
6262
$bag->getDate('foo');
6363
}

Tests/HeaderUtilsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function testUnquote()
9999

100100
public function testMakeDispositionInvalidDisposition()
101101
{
102-
$this->expectException('InvalidArgumentException');
102+
$this->expectException(\InvalidArgumentException::class);
103103
HeaderUtils::makeDisposition('invalid', 'foo.html');
104104
}
105105

@@ -128,7 +128,7 @@ public function provideMakeDisposition()
128128
*/
129129
public function testMakeDispositionFail($disposition, $filename)
130130
{
131-
$this->expectException('InvalidArgumentException');
131+
$this->expectException(\InvalidArgumentException::class);
132132
HeaderUtils::makeDisposition($disposition, $filename);
133133
}
134134

Tests/IpUtilsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getIpv6Data()
7777
*/
7878
public function testAnIpv6WithOptionDisabledIpv6()
7979
{
80-
$this->expectException('RuntimeException');
80+
$this->expectException(\RuntimeException::class);
8181
if (\defined('AF_INET6')) {
8282
$this->markTestSkipped('Only works when PHP is compiled with the option "disable-ipv6".');
8383
}

0 commit comments

Comments
 (0)