Skip to content

Commit 6a90e0e

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: Use ::class keyword when possible
2 parents daceb7d + 9ebc4cf commit 6a90e0e

13 files changed

+17
-17
lines changed

Command/AboutCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8989
new TableSeparator(),
9090
['Version', \PHP_VERSION],
9191
['Architecture', (\PHP_INT_SIZE * 8).' bits'],
92-
['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'],
92+
['Intl locale', class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'],
9393
['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'],
9494
['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],
9595
['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'],

Tests/CacheWarmer/AnnotationsCacheWarmerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function testClassAutoloadExceptionWithUnrelatedException()
125125
*/
126126
private function getReadOnlyReader(): object
127127
{
128-
$readerMock = $this->getMockBuilder('Doctrine\Common\Annotations\Reader')->getMock();
128+
$readerMock = $this->getMockBuilder(Reader::class)->getMock();
129129
$readerMock->expects($this->exactly(0))->method('getClassAnnotations');
130130
$readerMock->expects($this->exactly(0))->method('getClassAnnotation');
131131
$readerMock->expects($this->exactly(0))->method('getMethodAnnotations');

Tests/Command/CachePoolDeleteCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testCommandDeleteFailed()
8989
private function getKernel(): object
9090
{
9191
$container = $this
92-
->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')
92+
->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)
9393
->getMock();
9494

9595
$kernel = $this

Tests/Command/CachePruneCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private function getEmptyRewindableGenerator(): RewindableGenerator
5555
private function getKernel(): object
5656
{
5757
$container = $this
58-
->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')
58+
->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)
5959
->getMock();
6060

6161
$kernel = $this

Tests/Command/RouterMatchCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private function getRouter()
5555
$routeCollection = new RouteCollection();
5656
$routeCollection->add('foo', new Route('foo'));
5757
$requestContext = new RequestContext();
58-
$router = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->getMock();
58+
$router = $this->getMockBuilder(\Symfony\Component\Routing\RouterInterface::class)->getMock();
5959
$router
6060
->expects($this->any())
6161
->method('getRouteCollection')
@@ -70,7 +70,7 @@ private function getRouter()
7070

7171
private function getKernel()
7272
{
73-
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
73+
$container = $this->getMockBuilder(\Symfony\Component\DependencyInjection\ContainerInterface::class)->getMock();
7474
$container
7575
->expects($this->atLeastOnce())
7676
->method('has')

Tests/Command/YamlLintCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testLintIncorrectFile()
6060

6161
public function testLintFileNotReadable()
6262
{
63-
$this->expectException('RuntimeException');
63+
$this->expectException(\RuntimeException::class);
6464
$tester = $this->createCommandTester();
6565
$filename = $this->createFile('');
6666
unlink($filename);

Tests/Controller/AbstractControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testGetParameter()
8282

8383
public function testMissingParameterBag()
8484
{
85-
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
85+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
8686
$this->expectExceptionMessage('TestAbstractController::getParameter()" method is missing a parameter bag');
8787
$container = new Container();
8888

Tests/DependencyInjection/Compiler/ProfilerPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ProfilerPassTest extends TestCase
3434
*/
3535
public function testTemplateNoIdThrowsException()
3636
{
37-
$this->expectException('InvalidArgumentException');
37+
$this->expectException(\InvalidArgumentException::class);
3838
$builder = new ContainerBuilder();
3939
$builder->register('profiler', 'ProfilerClass');
4040
$builder->register('my_collector_service')

Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testNoExeptionIfAllDependenciesArePresent()
5454

5555
public function testExceptionIfTheTokenStorageServiceIsNotPresent()
5656
{
57-
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
57+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
5858
$this->expectExceptionMessage('The "security.token_storage" service is needed to be able to use the workflow guard listener.');
5959
$this->container->setParameter('workflow.has_guard_listeners', true);
6060
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
@@ -66,7 +66,7 @@ public function testExceptionIfTheTokenStorageServiceIsNotPresent()
6666

6767
public function testExceptionIfTheAuthorizationCheckerServiceIsNotPresent()
6868
{
69-
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
69+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
7070
$this->expectExceptionMessage('The "security.authorization_checker" service is needed to be able to use the workflow guard listener.');
7171
$this->container->setParameter('workflow.has_guard_listeners', true);
7272
$this->container->register('security.token_storage', TokenStorageInterface::class);
@@ -78,7 +78,7 @@ public function testExceptionIfTheAuthorizationCheckerServiceIsNotPresent()
7878

7979
public function testExceptionIfTheAuthenticationTrustResolverServiceIsNotPresent()
8080
{
81-
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
81+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
8282
$this->expectExceptionMessage('The "security.authentication.trust_resolver" service is needed to be able to use the workflow guard listener.');
8383
$this->container->setParameter('workflow.has_guard_listeners', true);
8484
$this->container->register('security.token_storage', TokenStorageInterface::class);
@@ -90,7 +90,7 @@ public function testExceptionIfTheAuthenticationTrustResolverServiceIsNotPresent
9090

9191
public function testExceptionIfTheRoleHierarchyServiceIsNotPresent()
9292
{
93-
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
93+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
9494
$this->expectExceptionMessage('The "security.role_hierarchy" service is needed to be able to use the workflow guard listener.');
9595
$this->container->setParameter('workflow.has_guard_listeners', true);
9696
$this->container->register('security.token_storage', TokenStorageInterface::class);

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function getTestValidSessionName()
4848
*/
4949
public function testInvalidSessionName($sessionName)
5050
{
51-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
51+
$this->expectException(InvalidConfigurationException::class);
5252
$processor = new Processor();
5353
$processor->processConfiguration(
5454
new Configuration(true),

Tests/Functional/CachePoolClearCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testCallClearer()
6767

6868
public function testClearUnexistingPool()
6969
{
70-
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
70+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException::class);
7171
$this->expectExceptionMessage('You have requested a non-existent service "unknown_pool"');
7272
$this->createCommandTester()
7373
->execute(['pools' => ['unknown_pool']], ['decorated' => false]);

Tests/Functional/RouterDebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testSearchMultipleRoutes()
6363

6464
public function testSearchWithThrow()
6565
{
66-
$this->expectException('InvalidArgumentException');
66+
$this->expectException(\InvalidArgumentException::class);
6767
$this->expectExceptionMessage('The route "gerard" does not exist.');
6868
$tester = $this->createCommandTester();
6969
$tester->execute(['name' => 'gerard'], ['interactive' => true]);

Tests/Kernel/MicroKernelTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function test()
5252

5353
$this->assertEquals('halloween', $response->getContent());
5454
$this->assertEquals('Have a great day!', $kernel->getContainer()->getParameter('halloween'));
55-
$this->assertInstanceOf('stdClass', $kernel->getContainer()->get('halloween'));
55+
$this->assertInstanceOf(\stdClass::class, $kernel->getContainer()->get('halloween'));
5656
}
5757

5858
public function testAsEventSubscriber()

0 commit comments

Comments
 (0)