mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 13:26:37 +00:00
removed the ability to register a global variable after the runtime or the extensions have been initialized
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 2.0.0 (201X-XX-XX)
|
||||
|
||||
* removed the ability to register a global variable after the runtime or the extensions have been initialized
|
||||
* improved the performance of the filesystem loader
|
||||
* removed features that were deprecated in 1.x
|
||||
|
||||
|
||||
@@ -1044,11 +1044,9 @@ class Twig_Environment
|
||||
$this->globals = $this->initGlobals();
|
||||
}
|
||||
|
||||
/* This condition must be uncommented in Twig 2.0
|
||||
if (!array_key_exists($name, $this->globals)) {
|
||||
throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if ($this->extensionInitialized || $this->runtimeInitialized) {
|
||||
|
||||
@@ -87,7 +87,6 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
||||
$template = $twig->loadTemplate('index');
|
||||
$this->assertEquals('bar', $template->render(array()));
|
||||
|
||||
/* to be uncomment in Twig 2.0
|
||||
// globals cannot be added after runtime init
|
||||
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||
$twig->addGlobal('foo', 'foo');
|
||||
@@ -134,7 +133,6 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
||||
} catch (LogicException $e) {
|
||||
$this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()
|
||||
|
||||
Reference in New Issue
Block a user