Skip to content

Commit 41a1b8c

Browse files
committed
Use ::class keyword when possible
1 parent 3bcfdc9 commit 41a1b8c

File tree

51 files changed

+168
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+168
-168
lines changed

DataCollector/ConfigDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function collect(Request $request, Response $response/*, \Throwable $exce
6969
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
7070
'php_version' => \PHP_VERSION,
7171
'php_architecture' => \PHP_INT_SIZE * 8,
72-
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
72+
'php_intl_locale' => class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
7373
'php_timezone' => date_default_timezone_get(),
7474
'xdebug_enabled' => \extension_loaded('xdebug'),
7575
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN),

Kernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ protected function getContainerBuilder()
748748
if ($this instanceof CompilerPassInterface) {
749749
$container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000);
750750
}
751-
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
751+
if (class_exists(\ProxyManager\Configuration::class) && class_exists(RuntimeInstantiator::class)) {
752752
$container->setProxyInstantiator(new RuntimeInstantiator());
753753
}
754754

@@ -766,7 +766,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
766766
// cache the container
767767
$dumper = new PhpDumper($container);
768768

769-
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
769+
if (class_exists(\ProxyManager\Configuration::class) && class_exists(ProxyDumper::class)) {
770770
$dumper->setProxyDumper(new ProxyDumper());
771771
}
772772

Tests/Bundle/BundleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testGetContainerExtension()
3030

3131
public function testGetContainerExtensionWithInvalidClass()
3232
{
33-
$this->expectException('LogicException');
33+
$this->expectException(\LogicException::class);
3434
$this->expectExceptionMessage('must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface');
3535
$bundle = new ExtensionNotValidBundle();
3636
$bundle->getContainerExtension();

Tests/CacheClearer/ChainCacheClearerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ public function testInjectClearersInConstructor()
4141

4242
protected function getMockClearer()
4343
{
44-
return $this->getMockBuilder('Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface')->getMock();
44+
return $this->getMockBuilder(\Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface::class)->getMock();
4545
}
4646
}

Tests/CacheClearer/Psr6CacheClearerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testClearPool()
3939

4040
public function testClearPoolThrowsExceptionOnUnreferencedPool()
4141
{
42-
$this->expectException('InvalidArgumentException');
42+
$this->expectException(\InvalidArgumentException::class);
4343
$this->expectExceptionMessage('Cache pool not found: "unknown"');
4444
(new Psr6CacheClearer())->clearPool('unknown');
4545
}

Tests/CacheWarmer/CacheWarmerAggregateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testWarmupDoesNotCallWarmupOnOptionalWarmersWhenEnableOptionalWa
7070

7171
protected function getCacheWarmerMock()
7272
{
73-
$warmer = $this->getMockBuilder('Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface')
73+
$warmer = $this->getMockBuilder(\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface::class)
7474
->disableOriginalConstructor()
7575
->getMock();
7676

Tests/CacheWarmer/CacheWarmerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testWriteCacheFileCreatesTheFile()
3838

3939
public function testWriteNonWritableCacheFileThrowsARuntimeException()
4040
{
41-
$this->expectException('RuntimeException');
41+
$this->expectException(\RuntimeException::class);
4242
$nonWritableFile = '/this/file/is/very/probably/not/writable';
4343
$warmer = new TestCacheWarmer($nonWritableFile);
4444
$warmer->warmUp(\dirname($nonWritableFile));

Tests/Config/FileLocatorTest.php

Lines changed: 3 additions & 3 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

@@ -39,7 +39,7 @@ public function testLocate()
3939
*/
4040
public function testLocateWithGlobalResourcePath()
4141
{
42-
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
42+
$kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
4343
$kernel
4444
->expects($this->atLeastOnce())
4545
->method('locateResource')

Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testDoNotSupportEmptyController()
5555

5656
public function testController()
5757
{
58-
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
58+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
5959
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
6060
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
6161
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
@@ -66,7 +66,7 @@ public function testController()
6666

6767
public function testControllerWithATrailingBackSlash()
6868
{
69-
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
69+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
7070
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
7171
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
7272
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
@@ -77,7 +77,7 @@ public function testControllerWithATrailingBackSlash()
7777

7878
public function testControllerWithMethodNameStartUppercase()
7979
{
80-
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
80+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
8181
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
8282
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
8383
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);
@@ -88,7 +88,7 @@ public function testControllerWithMethodNameStartUppercase()
8888

8989
public function testControllerNameIsAnArray()
9090
{
91-
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
91+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
9292
$this->expectExceptionMessage('Could not resolve argument $dummy of "App\Controller\Mine::method()", maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?');
9393
$resolver = new NotTaggedControllerValueResolver(new ServiceLocator([]));
9494
$argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null);

Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testControllerNameIsAnArray()
107107

108108
public function testErrorIsTruncated()
109109
{
110-
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
110+
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
111111
$this->expectExceptionMessage('Cannot autowire argument $dummy of "Symfony\Component\HttpKernel\Tests\Controller\ArgumentResolver\DummyController::index()": it references class "Symfony\Component\HttpKernel\Tests\Controller\ArgumentResolver\DummyService" but no such service exists.');
112112
$container = new ContainerBuilder();
113113
$container->addCompilerPass(new RegisterControllerArgumentLocatorsPass());

0 commit comments

Comments
 (0)