Skip to content

Commit df6ad15

Browse files
[HttpKernel] fix deprecating KernelInterface::getRootDir()
1 parent b5436a4 commit df6ad15

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
4.2.0
55
-----
66

7-
* deprecated `Kernel::getRootDir()` and the `kernel.root_dir` parameter
7+
* deprecated `KernelInterface::getRootDir()` and the `kernel.root_dir` parameter
88
* deprecated `KernelInterface::getName()` and the `kernel.name` parameter
99

1010
4.1.0

KernelInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ public function isDebug();
123123
* Gets the application root dir (path of the project's Kernel class).
124124
*
125125
* @return string The Kernel root dir
126+
*
127+
* @deprecated since Symfony 4.2
126128
*/
127129
public function getRootDir();
128130

Tests/Fixtures/KernelWithoutBundles.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public function registerContainerConfiguration(LoaderInterface $loader)
2626
{
2727
}
2828

29+
public function getProjectDir()
30+
{
31+
return __DIR__;
32+
}
33+
2934
protected function build(ContainerBuilder $container)
3035
{
3136
$container->setParameter('test_executed', true);

Tests/KernelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ public function testProjectDirExtension()
521521
$kernel->boot();
522522

523523
$this->assertSame(__DIR__.'/Fixtures', $kernel->getProjectDir());
524-
$this->assertSame(__DIR__.'/Fixtures', $kernel->getContainer()->getParameter('kernel.project_dir'));
524+
$this->assertSame(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures', $kernel->getContainer()->getParameter('kernel.project_dir'));
525525
}
526526

527527
public function testKernelReset()

0 commit comments

Comments
 (0)