Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Kernel::$name to be overridden by subclasses
Because the name of the kernel is calculated in the constructor, any child class that had overriden the kernel name, will be ignored. By setting the kernel name in the child class, we can avoid having to execute the regex to calculate the name upon every construction of a Kernel. A test (and a kernel fixture) is added to prove that the override works correctly. Note: the Kernel API has not been touched, so there should be no issues with BC.
- Loading branch information
1 parent
064ad62
commit 02e0a8f
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\HttpKernel\Tests\Fixtures; | ||
|
||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
|
||
class KernelForOverrideName extends Kernel | ||
{ | ||
protected $name = 'overridden'; | ||
|
||
public function registerBundles() | ||
{ | ||
|
||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters