removed obsolete code

This commit is contained in:
Fabien Potencier
2016-11-15 16:58:57 -05:00
parent 5a7b20205d
commit 183f062bbf
6 changed files with 1 additions and 67 deletions
-8
View File
@@ -50,11 +50,6 @@ returns a ``Twig_TemplateWrapper`` instance::
$template = $twig->load('index.html');
.. note::
Before Twig 1.28, you should use ``loadTemplate()`` instead which returns a
``Twig_Template`` instance.
To render the template with some variables, call the ``render()`` method::
echo $template->render(array('the' => 'variables', 'go' => 'here'));
@@ -67,9 +62,6 @@ You can also load and render the template in one fell swoop::
echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here'));
.. versionadded:: 1.28
The possibility to render blocks from the API was added in Twig 1.28.
If a template defines blocks, they can be rendered individually via the
``renderBlock()`` call::
-4
View File
@@ -39,10 +39,6 @@ And if the expression evaluates to a ``Twig_Template`` or a
// {{ include(template) }}
// deprecated as of Twig 1.28
$template = $twig->loadTemplate('some_template.twig');
// as of Twig 1.28
$template = $twig->load('some_template.twig');
$twig->display('template.twig', array('template' => $template));
-4
View File
@@ -158,10 +158,6 @@ instance, Twig will use it as the parent template::
// {% extends layout %}
// deprecated as of Twig 1.28
$layout = $twig->loadTemplate('some_layout_template.twig');
// as of Twig 1.28
$layout = $twig->load('some_layout_template.twig');
$twig->display('template.twig', array('layout' => $layout));
-4
View File
@@ -55,10 +55,6 @@ And if the expression evaluates to a ``Twig_Template`` or a
// {% include template %}
// deprecated as of Twig 1.28
$template = $twig->loadTemplate('some_template.twig');
// as of Twig 1.28
$template = $twig->load('some_template.twig');
$twig->display('template.twig', array('template' => $template));
+1 -7
View File
@@ -289,14 +289,8 @@ abstract class Twig_Template
*
* @internal
*/
public function getBlockNames(array $context = null, array $blocks = array())
public function getBlockNames(array $context, array $blocks = array())
{
if (null === $context) {
@trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED);
return array_keys($this->blocks);
}
$names = array_merge(array_keys($blocks), array_keys($this->blocks));
if (false !== $parent = $this->getParent($context)) {
-40
View File
@@ -128,46 +128,6 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
return $tests;
}
/**
* @dataProvider getGetAttributeWithTemplateAsObject
* @group legacy
*/
public function testGetAttributeWithTemplateAsObject($useExt)
{
$template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $useExt);
$template1 = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), false);
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
$this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true'));
$this->assertEquals('1', $template->getAttribute($template1, 'true'));
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero'));
$this->assertEquals('0', $template->getAttribute($template1, 'zero'));
$this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty'));
$this->assertSame('', $template->getAttribute($template1, 'empty'));
$this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true));
$this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true));
$this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true));
$this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true));
}
public function getGetAttributeWithTemplateAsObject()
{
$bools = array(
array(false),
);
if (function_exists('twig_template_get_attributes')) {
$bools[] = array(true);
}
return $bools;
}
/**
* @dataProvider getTestsDependingOnExtensionAvailability
*/