Skip to content

Commit 5738f2f

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Use ::class keyword when possible
2 parents 7468748 + 41a1b8c commit 5738f2f

Some content is hidden

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

46 files changed

+148
-148
lines changed

DataCollector/ConfigDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function collect(Request $request, Response $response, \Throwable $except
5050
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
5151
'php_version' => \PHP_VERSION,
5252
'php_architecture' => \PHP_INT_SIZE * 8,
53-
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
53+
'php_intl_locale' => class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
5454
'php_timezone' => date_default_timezone_get(),
5555
'xdebug_enabled' => \extension_loaded('xdebug'),
5656
'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
@@ -683,7 +683,7 @@ protected function getContainerBuilder()
683683
if ($this instanceof CompilerPassInterface) {
684684
$container->addCompilerPass($this, PassConfig::TYPE_BEFORE_OPTIMIZATION, -10000);
685685
}
686-
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
686+
if (class_exists(\ProxyManager\Configuration::class) && class_exists(RuntimeInstantiator::class)) {
687687
$container->setProxyInstantiator(new RuntimeInstantiator());
688688
}
689689

@@ -701,7 +701,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
701701
// cache the container
702702
$dumper = new PhpDumper($container);
703703

704-
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
704+
if (class_exists(\ProxyManager\Configuration::class) && class_exists(ProxyDumper::class)) {
705705
$dumper->setProxyDumper(new ProxyDumper());
706706
}
707707

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/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());

Tests/Controller/ArgumentResolverTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function testGetVariadicArguments()
164164

165165
public function testGetVariadicArgumentsWithoutArrayInRequest()
166166
{
167-
$this->expectException('InvalidArgumentException');
167+
$this->expectException(\InvalidArgumentException::class);
168168
$request = Request::create('/');
169169
$request->attributes->set('foo', 'foo');
170170
$request->attributes->set('bar', 'foo');
@@ -175,7 +175,7 @@ public function testGetVariadicArgumentsWithoutArrayInRequest()
175175

176176
public function testGetArgumentWithoutArray()
177177
{
178-
$this->expectException('InvalidArgumentException');
178+
$this->expectException(\InvalidArgumentException::class);
179179
$factory = new ArgumentMetadataFactory();
180180
$valueResolver = $this->getMockBuilder(ArgumentValueResolverInterface::class)->getMock();
181181
$resolver = new ArgumentResolver($factory, [$valueResolver]);
@@ -192,7 +192,7 @@ public function testGetArgumentWithoutArray()
192192

193193
public function testIfExceptionIsThrownWhenMissingAnArgument()
194194
{
195-
$this->expectException('RuntimeException');
195+
$this->expectException(\RuntimeException::class);
196196
$request = Request::create('/');
197197
$controller = [$this, 'controllerWithFoo'];
198198

@@ -251,7 +251,7 @@ public function testGetSessionArgumentsWithInterface()
251251

252252
public function testGetSessionMissMatchWithInterface()
253253
{
254-
$this->expectException('RuntimeException');
254+
$this->expectException(\RuntimeException::class);
255255
$session = $this->getMockBuilder(SessionInterface::class)->getMock();
256256
$request = Request::create('/');
257257
$request->setSession($session);
@@ -262,7 +262,7 @@ public function testGetSessionMissMatchWithInterface()
262262

263263
public function testGetSessionMissMatchWithImplementation()
264264
{
265-
$this->expectException('RuntimeException');
265+
$this->expectException(\RuntimeException::class);
266266
$session = new Session(new MockArraySessionStorage());
267267
$request = Request::create('/');
268268
$request->setSession($session);
@@ -273,7 +273,7 @@ public function testGetSessionMissMatchWithImplementation()
273273

274274
public function testGetSessionMissMatchOnNull()
275275
{
276-
$this->expectException('RuntimeException');
276+
$this->expectException(\RuntimeException::class);
277277
$request = Request::create('/');
278278
$controller = [$this, 'controllerWithExtendingSession'];
279279

0 commit comments

Comments
 (0)