Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4964ffc

Browse filesBrowse files
[HttpKernel] fix kernel.name deprecation
1 parent 97c8fac commit 4964ffc
Copy full SHA for 4964ffc

File tree

Expand file treeCollapse file tree

13 files changed

+23
-46
lines changed
Filter options
Expand file treeCollapse file tree

13 files changed

+23
-46
lines changed

‎src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
367367
} else {
368368
$seed = '_'.$container->getParameter('kernel.project_dir');
369369
}
370-
$seed .= '.'.$container->getParameter('kernel.container_class').'.'.$container->getParameter('kernel.environment').'.'.$container->getParameter('kernel.debug');
370+
$seed .= '.'.$container->getParameter('kernel.container_class');
371371
$namespace = 'sf_'.$this->getMappingResourceExtension().'_'.$objectManagerName.'_'.ContainerBuilder::hash($seed);
372372

373373
$cacheDriver['namespace'] = $namespace;

‎src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ protected function createContainer(array $data = array())
269269
return new ContainerBuilder(new ParameterBag(array_merge(array(
270270
'kernel.bundles' => array('FrameworkBundle' => 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'),
271271
'kernel.cache_dir' => __DIR__,
272-
'kernel.debug' => false,
273-
'kernel.environment' => 'test',
274272
'kernel.container_class' => 'kernel',
275273
'kernel.project_dir' => __DIR__,
276274
), $data)));

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<service id="data_collector.config" class="Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector">
1111
<tag name="data_collector" template="@WebProfiler/Collector/config.html.twig" id="config" priority="-255" />
1212
<call method="setKernel"><argument type="service" id="kernel" on-invalid="ignore" /></call>
13+
<argument type="service">
14+
<service class="string">
15+
<factory function="basename" />
16+
<argument>%kernel.project_dir%</argument>
17+
</service>
18+
</argument>
1319
</service>
1420

1521
<service id="data_collector.request" class="Symfony\Component\HttpKernel\DataCollector\RequestDataCollector">

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolClearerPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolClearerPassTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class CachePoolClearerPassTest extends TestCase
2929
public function testPoolRefsAreWeak()
3030
{
3131
$container = new ContainerBuilder();
32-
$container->setParameter('kernel.debug', false);
3332
$container->setParameter('kernel.container_class', 'app');
34-
$container->setParameter('kernel.environment', 'prod');
3533
$container->setParameter('kernel.project_dir', 'foo');
3634

3735
$globalClearer = new Definition(Psr6CacheClearer::class);

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php
+3-12Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ protected function setUp()
3434
public function testNamespaceArgumentIsReplaced()
3535
{
3636
$container = new ContainerBuilder();
37-
$container->setParameter('kernel.debug', false);
3837
$container->setParameter('kernel.container_class', 'app');
39-
$container->setParameter('kernel.environment', 'prod');
4038
$container->setParameter('kernel.project_dir', 'foo');
4139
$adapter = new Definition();
4240
$adapter->setAbstract(true);
@@ -50,13 +48,12 @@ public function testNamespaceArgumentIsReplaced()
5048

5149
$this->cachePoolPass->process($container);
5250

53-
$this->assertSame('D07rhFx97S', $cachePool->getArgument(0));
51+
$this->assertSame('z3X945Jbf5', $cachePool->getArgument(0));
5452
}
5553

5654
public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
5755
{
5856
$container = new ContainerBuilder();
59-
$container->setParameter('kernel.environment', 'prod');
6057
$container->setParameter('kernel.container_class', 'app');
6158
$container->setParameter('kernel.project_dir', 'foo');
6259

@@ -74,9 +71,7 @@ public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
7471
public function testArgsAreReplaced()
7572
{
7673
$container = new ContainerBuilder();
77-
$container->setParameter('kernel.debug', false);
7874
$container->setParameter('kernel.container_class', 'app');
79-
$container->setParameter('kernel.environment', 'prod');
8075
$container->setParameter('cache.prefix.seed', 'foo');
8176
$cachePool = new Definition();
8277
$cachePool->addTag('cache.pool', array(
@@ -92,16 +87,14 @@ public function testArgsAreReplaced()
9287

9388
$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
9489
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
95-
$this->assertSame('itantF+pIq', $cachePool->getArgument(1));
90+
$this->assertSame('tQNhcV-8xa', $cachePool->getArgument(1));
9691
$this->assertSame(3, $cachePool->getArgument(2));
9792
}
9893

9994
public function testWithNameAttribute()
10095
{
10196
$container = new ContainerBuilder();
102-
$container->setParameter('kernel.debug', false);
10397
$container->setParameter('kernel.container_class', 'app');
104-
$container->setParameter('kernel.environment', 'prod');
10598
$container->setParameter('cache.prefix.seed', 'foo');
10699
$cachePool = new Definition();
107100
$cachePool->addTag('cache.pool', array(
@@ -115,7 +108,7 @@ public function testWithNameAttribute()
115108

116109
$this->cachePoolPass->process($container);
117110

118-
$this->assertSame('9HvPgAayyh', $cachePool->getArgument(1));
111+
$this->assertSame('+naTpPa4Sm', $cachePool->getArgument(1));
119112
}
120113

121114
/**
@@ -125,9 +118,7 @@ public function testWithNameAttribute()
125118
public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()
126119
{
127120
$container = new ContainerBuilder();
128-
$container->setParameter('kernel.debug', false);
129121
$container->setParameter('kernel.container_class', 'app');
130-
$container->setParameter('kernel.environment', 'prod');
131122
$container->setParameter('kernel.project_dir', 'foo');
132123
$adapter = new Definition();
133124
$adapter->setAbstract(true);

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@
154154
<span class="label">Symfony version</span>
155155
</div>
156156

157-
{% if 'n/a' != collector.appname %}
158-
<div class="metric">
159-
<span class="value">{{ collector.appname }}</span>
160-
<span class="label">Application name</span>
161-
</div>
162-
{% endif %}
163-
164157
{% if 'n/a' != collector.env %}
165158
<div class="metric">
166159
<span class="value">{{ collector.env }}</span>

‎src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function process(ContainerBuilder $container)
5252
} else {
5353
$seed = '_'.$container->getParameter('kernel.project_dir');
5454
}
55-
$seed .= '.'.$container->getParameter('kernel.container_class').'.'.$container->getParameter('kernel.environment');
55+
$seed .= '.'.$container->getParameter('kernel.container_class');
5656

5757
$pools = array();
5858
$clearers = array();

‎src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class CachePoolClearerPassTest extends TestCase
2626
public function testPoolRefsAreWeak()
2727
{
2828
$container = new ContainerBuilder();
29-
$container->setParameter('kernel.debug', false);
3029
$container->setParameter('kernel.container_class', 'app');
31-
$container->setParameter('kernel.environment', 'prod');
3230
$container->setParameter('kernel.project_dir', 'foo');
3331

3432
$globalClearer = new Definition(Psr6CacheClearer::class);

‎src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php
+3-12Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ protected function setUp()
3131
public function testNamespaceArgumentIsReplaced()
3232
{
3333
$container = new ContainerBuilder();
34-
$container->setParameter('kernel.debug', false);
3534
$container->setParameter('kernel.container_class', 'app');
36-
$container->setParameter('kernel.environment', 'prod');
3735
$container->setParameter('kernel.project_dir', 'foo');
3836
$adapter = new Definition();
3937
$adapter->setAbstract(true);
@@ -47,13 +45,12 @@ public function testNamespaceArgumentIsReplaced()
4745

4846
$this->cachePoolPass->process($container);
4947

50-
$this->assertSame('D07rhFx97S', $cachePool->getArgument(0));
48+
$this->assertSame('z3X945Jbf5', $cachePool->getArgument(0));
5149
}
5250

5351
public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
5452
{
5553
$container = new ContainerBuilder();
56-
$container->setParameter('kernel.environment', 'prod');
5754
$container->setParameter('kernel.container_class', 'app');
5855
$container->setParameter('kernel.project_dir', 'foo');
5956

@@ -71,9 +68,7 @@ public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
7168
public function testArgsAreReplaced()
7269
{
7370
$container = new ContainerBuilder();
74-
$container->setParameter('kernel.debug', false);
7571
$container->setParameter('kernel.container_class', 'app');
76-
$container->setParameter('kernel.environment', 'prod');
7772
$container->setParameter('cache.prefix.seed', 'foo');
7873
$cachePool = new Definition();
7974
$cachePool->addTag('cache.pool', array(
@@ -89,16 +84,14 @@ public function testArgsAreReplaced()
8984

9085
$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
9186
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
92-
$this->assertSame('itantF+pIq', $cachePool->getArgument(1));
87+
$this->assertSame('tQNhcV-8xa', $cachePool->getArgument(1));
9388
$this->assertSame(3, $cachePool->getArgument(2));
9489
}
9590

9691
public function testWithNameAttribute()
9792
{
9893
$container = new ContainerBuilder();
99-
$container->setParameter('kernel.debug', false);
10094
$container->setParameter('kernel.container_class', 'app');
101-
$container->setParameter('kernel.environment', 'prod');
10295
$container->setParameter('cache.prefix.seed', 'foo');
10396
$cachePool = new Definition();
10497
$cachePool->addTag('cache.pool', array(
@@ -112,7 +105,7 @@ public function testWithNameAttribute()
112105

113106
$this->cachePoolPass->process($container);
114107

115-
$this->assertSame('9HvPgAayyh', $cachePool->getArgument(1));
108+
$this->assertSame('+naTpPa4Sm', $cachePool->getArgument(1));
116109
}
117110

118111
/**
@@ -122,9 +115,7 @@ public function testWithNameAttribute()
122115
public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()
123116
{
124117
$container = new ContainerBuilder();
125-
$container->setParameter('kernel.debug', false);
126118
$container->setParameter('kernel.container_class', 'app');
127-
$container->setParameter('kernel.environment', 'prod');
128119
$container->setParameter('kernel.project_dir', 'foo');
129120
$adapter = new Definition();
130121
$adapter->setAbstract(true);

‎src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public function collect(Request $request, Response $response, \Exception $except
6060
'token' => $response->headers->get('X-Debug-Token'),
6161
'symfony_version' => Kernel::VERSION,
6262
'symfony_state' => 'unknown',
63-
'name' => 'n/a',
6463
'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
6564
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
6665
'php_version' => PHP_VERSION,
@@ -232,7 +231,9 @@ public function getPhpTimezone()
232231
*/
233232
public function getAppName()
234233
{
235-
return $this->data['name'];
234+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
235+
236+
return 'n/a';
236237
}
237238

238239
/**

‎src/Symfony/Component/HttpKernel/Kernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Kernel.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ public function locateResource($name, $dir = null, $first = true)
276276

277277
/**
278278
* {@inheritdoc}
279+
*
280+
* @deprecated since Symfony 4.2
279281
*/
280282
public function getName(/* $triggerDeprecation = true */)
281283
{
@@ -440,7 +442,7 @@ protected function build(ContainerBuilder $container)
440442
*/
441443
protected function getContainerClass()
442444
{
443-
return str_replace('\\', '_', \get_class($this)).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container';
445+
return $this->name.str_replace('\\', '_', \get_class($this)).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container';
444446
}
445447

446448
/**

‎src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public function testCollect()
3030
$this->assertSame('test', $c->getEnv());
3131
$this->assertTrue($c->isDebug());
3232
$this->assertSame('config', $c->getName());
33-
$this->assertSame('n/a', $c->getAppName());
3433
$this->assertRegExp('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION);
3534
$this->assertRegExp('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION);
3635
$this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture());

‎src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/KernelTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testInitializeContainerClearsOldContainers()
7575
$kernel->boot();
7676

7777
$containerDir = __DIR__.'/Fixtures/var/cache/custom/'.substr(\get_class($kernel->getContainer()), 0, 16);
78-
$this->assertTrue(unlink(__DIR__.'/Fixtures/var/cache/custom/Symfony_Component_HttpKernel_Tests_CustomProjectDirKernelCustomDebugContainer.php.meta'));
78+
$this->assertTrue(unlink(__DIR__.'/Fixtures/var/cache/custom/FixturesSymfony_Component_HttpKernel_Tests_CustomProjectDirKernelCustomDebugContainer.php.meta'));
7979
$this->assertFileExists($containerDir);
8080
$this->assertFileNotExists($containerDir.'.legacy');
8181

@@ -533,14 +533,14 @@ public function testKernelReset()
533533

534534
$containerClass = \get_class($kernel->getContainer());
535535
$containerFile = (new \ReflectionClass($kernel->getContainer()))->getFileName();
536-
unlink(__DIR__.'/Fixtures/var/cache/custom/Symfony_Component_HttpKernel_Tests_CustomProjectDirKernelCustomDebugContainer.php.meta');
536+
unlink(__DIR__.'/Fixtures/var/cache/custom/FixturesSymfony_Component_HttpKernel_Tests_CustomProjectDirKernelCustomDebugContainer.php.meta');
537537

538538
$kernel = new CustomProjectDirKernel();
539539
$kernel->boot();
540540

541541
$this->assertInstanceOf($containerClass, $kernel->getContainer());
542542
$this->assertFileExists($containerFile);
543-
unlink(__DIR__.'/Fixtures/var/cache/custom/Symfony_Component_HttpKernel_Tests_CustomProjectDirKernelCustomDebugContainer.php.meta');
543+
unlink(__DIR__.'/Fixtures/var/cache/custom/FixturesSymfony_Component_HttpKernel_Tests_CustomProjectDirKernelCustomDebugContainer.php.meta');
544544

545545
$kernel = new CustomProjectDirKernel(function ($container) { $container->register('foo', 'stdClass')->setPublic(true); });
546546
$kernel->boot();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.