Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 03044f9

Browse files
committed
minor #39775 [WIP] Use ::class keyword when possible (fabpot)
This PR was merged into the 4.4 branch. Discussion ---------- [WIP] Use ::class keyword when possible | Q | A | ------------- | --- | Branch? | 4.4 <!-- see below --> | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | n/a Commits ------- 036a36cb14 Use ::class keyword when possible
2 parents ca25a7c + f7bb27a commit 03044f9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Core/Tests/Authentication/Token/AbstractTokenTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function testAttributes()
134134
$token->getAttribute('foobar');
135135
$this->fail('->getAttribute() throws an \InvalidArgumentException exception when the attribute does not exist');
136136
} catch (\Exception $e) {
137-
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getAttribute() throws an \InvalidArgumentException exception when the attribute does not exist');
137+
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '->getAttribute() throws an \InvalidArgumentException exception when the attribute does not exist');
138138
$this->assertEquals('This token has no "foobar" attribute.', $e->getMessage(), '->getAttribute() throws an \InvalidArgumentException exception when the attribute does not exist');
139139
}
140140
}

Http/Tests/Firewall/RememberMeListenerTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpFoundation\Request;
16+
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1617
use Symfony\Component\HttpKernel\Event\RequestEvent;
1718
use Symfony\Component\HttpKernel\Event\ResponseEvent;
1819
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2021
use Symfony\Component\Security\Http\Firewall\RememberMeListener;
2122
use Symfony\Component\Security\Http\SecurityEvents;
23+
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
2224
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
2325

2426
class RememberMeListenerTest extends TestCase
@@ -227,7 +229,7 @@ public function testSessionStrategy()
227229
->willReturn($token)
228230
;
229231

230-
$session = $this->getMockBuilder('\Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
232+
$session = $this->getMockBuilder(SessionInterface::class)->getMock();
231233
$session
232234
->expects($this->once())
233235
->method('isStarted')
@@ -277,7 +279,7 @@ public function testSessionIsMigratedByDefault()
277279
->willReturn($token)
278280
;
279281

280-
$session = $this->getMockBuilder('\Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock();
282+
$session = $this->getMockBuilder(SessionInterface::class)->getMock();
281283
$session
282284
->expects($this->once())
283285
->method('isStarted')
@@ -402,6 +404,6 @@ protected function getDispatcher()
402404

403405
private function getSessionStrategy()
404406
{
405-
return $this->getMockBuilder('\Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface')->getMock();
407+
return $this->getMockBuilder(SessionAuthenticationStrategyInterface::class)->getMock();
406408
}
407409
}

0 commit comments

Comments
 (0)