Skip to content

Commit 95be53e

Browse files
committed
Use ::class keyword when possible
1 parent 5738f2f commit 95be53e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Tests/Config/FileLocatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class FileLocatorTest extends TestCase
1818
{
1919
public function testLocate()
2020
{
21-
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
21+
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
2222
$kernel
2323
->expects($this->atLeastOnce())
2424
->method('locateResource')
@@ -30,7 +30,7 @@ public function testLocate()
3030
$kernel
3131
->expects($this->never())
3232
->method('locateResource');
33-
$this->expectException('LogicException');
33+
$this->expectException(\LogicException::class);
3434
$locator->locate('/some/path');
3535
}
3636
}

Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
2727
{
2828
public function testInvalidClass()
2929
{
30-
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
30+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
3131
$this->expectExceptionMessage('Class "Symfony\Component\HttpKernel\Tests\DependencyInjection\NotFound" used for service "foo" cannot be found.');
3232
$container = new ContainerBuilder();
3333
$container->register('argument_resolver.service')->addArgument([]);
@@ -42,7 +42,7 @@ public function testInvalidClass()
4242

4343
public function testNoAction()
4444
{
45-
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
45+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
4646
$this->expectExceptionMessage('Missing "action" attribute on tag "controller.service_arguments" {"argument":"bar"} for service "foo".');
4747
$container = new ContainerBuilder();
4848
$container->register('argument_resolver.service')->addArgument([]);
@@ -57,7 +57,7 @@ public function testNoAction()
5757

5858
public function testNoArgument()
5959
{
60-
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
60+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
6161
$this->expectExceptionMessage('Missing "argument" attribute on tag "controller.service_arguments" {"action":"fooAction"} for service "foo".');
6262
$container = new ContainerBuilder();
6363
$container->register('argument_resolver.service')->addArgument([]);
@@ -72,7 +72,7 @@ public function testNoArgument()
7272

7373
public function testNoService()
7474
{
75-
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
75+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
7676
$this->expectExceptionMessage('Missing "id" attribute on tag "controller.service_arguments" {"action":"fooAction","argument":"bar"} for service "foo".');
7777
$container = new ContainerBuilder();
7878
$container->register('argument_resolver.service')->addArgument([]);
@@ -87,7 +87,7 @@ public function testNoService()
8787

8888
public function testInvalidMethod()
8989
{
90-
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
90+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
9191
$this->expectExceptionMessage('Invalid "action" attribute on tag "controller.service_arguments" for service "foo": no public "barAction()" method found on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController".');
9292
$container = new ContainerBuilder();
9393
$container->register('argument_resolver.service')->addArgument([]);
@@ -102,7 +102,7 @@ public function testInvalidMethod()
102102

103103
public function testInvalidArgument()
104104
{
105-
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
105+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException::class);
106106
$this->expectExceptionMessage('Invalid "controller.service_arguments" tag for service "foo": method "fooAction()" has no "baz" argument on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController".');
107107
$container = new ContainerBuilder();
108108
$container->register('argument_resolver.service')->addArgument([]);
@@ -197,7 +197,7 @@ public function testSkipSetContainer()
197197

198198
public function testExceptionOnNonExistentTypeHint()
199199
{
200-
$this->expectException('RuntimeException');
200+
$this->expectException(\RuntimeException::class);
201201
$this->expectExceptionMessage('Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClass". Did you forget to add a use statement?');
202202
$container = new ContainerBuilder();
203203
$container->register('argument_resolver.service')->addArgument([]);
@@ -217,7 +217,7 @@ public function testExceptionOnNonExistentTypeHint()
217217

218218
public function testExceptionOnNonExistentTypeHintDifferentNamespace()
219219
{
220-
$this->expectException('RuntimeException');
220+
$this->expectException(\RuntimeException::class);
221221
$this->expectExceptionMessage('Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassDifferentNamespaceController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Acme\NonExistentClass".');
222222
$container = new ContainerBuilder();
223223
$container->register('argument_resolver.service')->addArgument([]);

Tests/Fragment/HIncludeFragmentRendererTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class HIncludeFragmentRendererTest extends TestCase
2323
{
2424
public function testRenderExceptionWhenControllerAndNoSigner()
2525
{
26-
$this->expectException('LogicException');
26+
$this->expectException(\LogicException::class);
2727
$strategy = new HIncludeFragmentRenderer();
2828
$strategy->render(new ControllerReference('main_controller', [], []), Request::create('/'));
2929
}

0 commit comments

Comments
 (0)