-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Deprecate the Kernel name #28809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,9 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl | |
protected $environment; | ||
protected $debug; | ||
protected $booted = false; | ||
/** | ||
* @deprecated since Symfony 4.2 | ||
*/ | ||
protected $name; | ||
protected $startTime; | ||
|
||
|
@@ -78,7 +81,7 @@ public function __construct(string $environment, bool $debug) | |
$this->environment = $environment; | ||
$this->debug = $debug; | ||
$this->rootDir = $this->getRootDir(); | ||
$this->name = $this->getName(); | ||
$this->name = $this->getName(false); | ||
} | ||
|
||
public function __clone() | ||
|
@@ -268,8 +271,12 @@ public function locateResource($name, $dir = null, $first = true) | |
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
public function getName(/* $triggerDeprecation = true */) | ||
{ | ||
if (0 === \func_num_args() || func_get_arg(0)) { | ||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); | ||
} | ||
|
||
if (null === $this->name) { | ||
$this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); | ||
if (ctype_digit($this->name[0])) { | ||
|
@@ -421,7 +428,7 @@ protected function build(ContainerBuilder $container) | |
*/ | ||
protected function getContainerClass() | ||
{ | ||
return $this->name.ucfirst($this->environment).($this->debug ? 'Debug' : '').'ProjectContainer'; | ||
return str_replace('\\', '_', \get_class($this)).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change breaks BC by removing the "name" (the basename of the project_dir really) from the dimensions that compose separate namespaces. |
||
} | ||
|
||
/** | ||
|
@@ -576,6 +583,9 @@ protected function getKernelParameters() | |
'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(), | ||
'kernel.environment' => $this->environment, | ||
'kernel.debug' => $this->debug, | ||
/* | ||
* @deprecated since Symfony 4.2 | ||
fabpot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
'kernel.name' => $this->name, | ||
'kernel.cache_dir' => realpath($cacheDir = $this->warmupDir ?: $this->getCacheDir()) ?: $cacheDir, | ||
'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(), | ||
|
Uh oh!
There was an error while loading. Please reload this page.