Skip to content

Commit

Permalink
[HttpKernel] fix deprecation notice for Kernel::init()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Dec 15, 2014
1 parent b5a315d commit cb70632
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
Expand Up @@ -74,10 +74,6 @@ public function registerBundles()
return include $filename;
}

public function init()
{
}

public function getRootDir()
{
return __DIR__;
Expand Down
Expand Up @@ -74,10 +74,6 @@ public function registerBundles()
return include $filename;
}

public function init()
{
}

public function getRootDir()
{
return __DIR__;
Expand Down
9 changes: 7 additions & 2 deletions src/Symfony/Component/HttpKernel/Kernel.php
Expand Up @@ -85,15 +85,20 @@ public function __construct($environment, $debug)
$this->startTime = microtime(true);
}

$this->init();
$defClass = new \ReflectionMethod($this, 'init');
$defClass = $defClass->getDeclaringClass()->name;

if (__CLASS__ !== $defClass) {
trigger_error(sprintf('Calling %s::init() was deprecated in Symfony 2.3 and will be removed in 3.0. Move your logic to the constructor instead.', $defClass), E_USER_DEPRECATED);
$this->init();
}
}

/**
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Move your logic in the constructor instead.
*/
public function init()
{
trigger_error('The Kernel::init() method was deprecated in version 2.3 and will be removed in 3.0. Move your logic to the constructor instead.', E_USER_DEPRECATED);
}

public function __clone()
Expand Down
Expand Up @@ -69,10 +69,6 @@ public function registerBundles()
{
}

public function init()
{
}

public function getBundles()
{
return array();
Expand Down

0 comments on commit cb70632

Please sign in to comment.