4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
11 class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
14 * @expectedException LogicException
16 public function testDisplayBlocksAcceptTemplateOnlyAsBlocks()
18 $template = $this->getMockForAbstractClass('Twig_Template', array(), '', false);
19 $template->displayBlock('foo', array(), array('foo' => array(new stdClass(), 'foo')));
23 * @dataProvider getAttributeExceptions
25 public function testGetAttributeExceptions($template, $message)
27 $templates = array('index' => $template);
28 $env = new Twig_Environment(new Twig_Loader_Array($templates), array('strict_variables' => true));
29 $template = $env->loadTemplate('index');
34 'empty_array' => array(),
35 'array' => array('foo' => 'foo'),
36 'array_access' => new Twig_TemplateArrayAccessObject(),
37 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(),
38 'object' => new stdClass(),
42 $template->render($context);
43 $this->fail('Accessing an invalid attribute should throw an exception.');
44 } catch (Twig_Error_Runtime $e) {
45 $this->assertSame(sprintf($message, 'index'), $e->getMessage());
49 public function getAttributeExceptions()
52 array('{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.'),
53 array('{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.'),
54 array('{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'),
55 array('{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'),
56 array('{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1.'),
57 array('{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.'),
58 array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'),
59 array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'),
60 array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'),
61 array('{{ array.a() }}', 'Impossible to invoke a method ("a") on an array in "%s" at line 1.'),
62 array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'),
63 array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'),
64 array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'),
65 array('{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'),
66 array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'),
67 array('{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.'),
68 array('{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1.'),
73 * @dataProvider getGetAttributeWithSandbox
75 public function testGetAttributeWithSandbox($object, $item, $allowed)
77 $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
78 $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(/*method*/), array(/*prop*/), array());
79 $twig->addExtension(new Twig_Extension_Sandbox($policy, !$allowed));
80 $template = new Twig_TemplateTest($twig);
83 $template->getAttribute($object, $item, array(), 'any');
88 $this->addToAssertionCount(1);
90 } catch (Twig_Sandbox_SecurityError $e) {
94 $this->addToAssertionCount(1);
97 $this->assertContains('is not allowed', $e->getMessage());
101 public function getGetAttributeWithSandbox()
104 array(new Twig_TemplatePropertyObject(), 'defined', false),
105 array(new Twig_TemplatePropertyObject(), 'defined', true),
106 array(new Twig_TemplateMethodObject(), 'defined', false),
107 array(new Twig_TemplateMethodObject(), 'defined', true),
114 public function testGetAttributeWithTemplateAsObject()
116 // to be removed in 2.0
117 $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
118 //$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface')->getMock());
120 $template = new Twig_TemplateTest($twig, 'index.twig');
121 $template1 = new Twig_TemplateTest($twig, 'index1.twig');
123 $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
124 $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
126 $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true'));
127 $this->assertEquals('1', $template->getAttribute($template1, 'true'));
129 $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero'));
130 $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
132 $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty'));
133 $this->assertSame('', $template->getAttribute($template1, 'empty'));
135 $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true));
136 $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true));
137 $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true));
138 $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true));
143 * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
144 * @expectedDeprecation Calling "string" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
145 * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
146 * @expectedDeprecation Calling "true" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
147 * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
148 * @expectedDeprecation Calling "zero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
149 * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
150 * @expectedDeprecation Calling "empty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
151 * @expectedDeprecation Calling "renderBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
152 * @expectedDeprecation Calling "displayBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
153 * @expectedDeprecation Calling "hasBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name") is defined" instead).
154 * @expectedDeprecation Calling "render" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
155 * @expectedDeprecation Calling "display" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
156 * @expectedDeprecation Calling "renderBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
157 * @expectedDeprecation Calling "displayBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
158 * @expectedDeprecation Calling "hasBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name", template) is defined" instead).
159 * @expectedDeprecation Calling "render" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
160 * @expectedDeprecation Calling "display" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
162 public function testGetAttributeWithTemplateAsObjectForDeprecations()
164 // to be removed in 2.0
165 $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
166 //$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface')->getMock());
168 $template = new Twig_TemplateTest($twig, 'index.twig');
169 $template1 = new Twig_TemplateTest($twig, 'index1.twig');
171 $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
172 $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
174 $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true'));
175 $this->assertEquals('1', $template->getAttribute($template1, 'true'));
177 $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero'));
178 $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
180 $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty'));
181 $this->assertSame('', $template->getAttribute($template1, 'empty'));
183 $blocks = array('name' => array($template1, 'block_name'));
185 // trigger some deprecation notice messages to check them with @expectedDeprecation
186 $template->getAttribute($template, 'renderBlock', array('name', array(), $blocks));
187 $template->getAttribute($template, 'displayBlock', array('name', array(), $blocks));
188 $template->getAttribute($template, 'hasBlock', array('name', array()));
189 $template->getAttribute($template, 'render', array(array()));
190 $template->getAttribute($template, 'display', array(array()));
192 $template->getAttribute($template1, 'renderBlock', array('name', array(), $blocks));
193 $template->getAttribute($template1, 'displayBlock', array('name', array(), $blocks));
194 $template->getAttribute($template1, 'hasBlock', array('name', array()));
195 $template->getAttribute($template1, 'render', array(array()));
196 $template->getAttribute($template1, 'display', array(array()));
198 $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true));
199 $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true));
200 $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true));
201 $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true));
206 * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence.
207 * @expectedDeprecation Silent display of undefined block "unknown" in template "index.twig" is deprecated since version 1.29 and will throw an exception in 2.0. Use the "block('unknown') is defined" expression to test for block existence.
209 public function testRenderBlockWithUndefinedBlock()
211 $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
213 $template = new Twig_TemplateTest($twig, 'index.twig');
214 $template->renderBlock('unknown', array());
215 $template->displayBlock('unknown', array());
218 public function testGetAttributeOnArrayWithConfusableKey()
220 $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
222 $array = array('Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros');
224 $this->assertSame('Zero', $array[false]);
225 $this->assertSame('One', $array[true]);
226 $this->assertSame('One', $array[1.5]);
227 $this->assertSame('One', $array['1']);
228 $this->assertSame('MinusOne', $array[-1.5]);
229 $this->assertSame('FloatButString', $array['1.5']);
230 $this->assertSame('IntegerButStringWithLeadingZeros', $array['01']);
231 $this->assertSame('EmptyString', $array[null]);
233 $this->assertSame('Zero', $template->getAttribute($array, false), 'false is treated as 0 when accessing an array (equals PHP behavior)');
234 $this->assertSame('One', $template->getAttribute($array, true), 'true is treated as 1 when accessing an array (equals PHP behavior)');
235 $this->assertSame('One', $template->getAttribute($array, 1.5), 'float is casted to int when accessing an array (equals PHP behavior)');
236 $this->assertSame('One', $template->getAttribute($array, '1'), '"1" is treated as integer 1 when accessing an array (equals PHP behavior)');
237 $this->assertSame('MinusOne', $template->getAttribute($array, -1.5), 'negative float is casted to int when accessing an array (equals PHP behavior)');
238 $this->assertSame('FloatButString', $template->getAttribute($array, '1.5'), '"1.5" is treated as-is when accessing an array (equals PHP behavior)');
239 $this->assertSame('IntegerButStringWithLeadingZeros', $template->getAttribute($array, '01'), '"01" is treated as-is when accessing an array (equals PHP behavior)');
240 $this->assertSame('EmptyString', $template->getAttribute($array, null), 'null is treated as "" when accessing an array (equals PHP behavior)');
244 * @dataProvider getGetAttributeTests
246 public function testGetAttribute($defined, $value, $object, $item, $arguments, $type)
248 $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
250 $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
254 * @dataProvider getGetAttributeTests
256 public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $exceptionMessage = null)
258 $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)));
261 $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
263 if (method_exists($this, 'expectException')) {
264 $this->expectException('Twig_Error_Runtime');
265 if (null !== $exceptionMessage) {
266 $this->expectExceptionMessage($exceptionMessage);
269 $this->setExpectedException('Twig_Error_Runtime', $exceptionMessage);
271 $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
276 * @dataProvider getGetAttributeTests
278 public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type)
280 $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
282 $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
286 * @dataProvider getGetAttributeTests
288 public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type)
290 $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)));
292 $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
295 public function testGetAttributeCallExceptions()
297 $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
299 $object = new Twig_TemplateMagicMethodExceptionObject();
301 $this->assertNull($template->getAttribute($object, 'foo'));
304 public function getGetAttributeTests()
307 'defined' => 'defined',
317 $objectArray = new Twig_TemplateArrayAccessObject();
318 $stdObject = (object) $array;
319 $magicPropertyObject = new Twig_TemplateMagicPropertyObject();
320 $propertyObject = new Twig_TemplatePropertyObject();
321 $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator();
322 $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess();
323 $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue();
324 $methodObject = new Twig_TemplateMethodObject();
325 $magicMethodObject = new Twig_TemplateMagicMethodObject();
327 $anyType = Twig_Template::ANY_CALL;
328 $methodType = Twig_Template::METHOD_CALL;
329 $arrayType = Twig_Template::ARRAY_CALL;
332 // array(defined, value, property to fetch)
333 array(true, 'defined', 'defined'),
334 array(false, null, 'undefined'),
335 array(false, null, 'protected'),
336 array(true, 0, 'zero'),
339 array(true, null, 'null'),
340 array(true, true, 'bar'),
341 array(true, 'baz', 'baz'),
342 array(true, '09', '09'),
343 array(true, '+4', '+4'),
345 $testObjects = array(
346 // array(object, type of fetch)
347 array($array, $arrayType),
348 array($objectArray, $arrayType),
349 array($stdObject, $anyType),
350 array($magicPropertyObject, $anyType),
351 array($methodObject, $methodType),
352 array($methodObject, $anyType),
353 array($propertyObject, $anyType),
354 array($propertyObject1, $anyType),
355 array($propertyObject2, $anyType),
359 foreach ($testObjects as $testObject) {
360 foreach ($basicTests as $test) {
361 // properties cannot be numbers
362 if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) {
366 if ('+4' === $test[2] && $methodObject === $testObject[0]) {
370 $tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]);
374 // additional properties tests
375 $tests = array_merge($tests, array(
376 array(true, null, $propertyObject3, 'foo', array(), $anyType),
379 // additional method tests
380 $tests = array_merge($tests, array(
381 array(true, 'defined', $methodObject, 'defined', array(), $methodType),
382 array(true, 'defined', $methodObject, 'DEFINED', array(), $methodType),
383 array(true, 'defined', $methodObject, 'getDefined', array(), $methodType),
384 array(true, 'defined', $methodObject, 'GETDEFINED', array(), $methodType),
385 array(true, 'static', $methodObject, 'static', array(), $methodType),
386 array(true, 'static', $methodObject, 'getStatic', array(), $methodType),
388 array(true, '__call_undefined', $magicMethodObject, 'undefined', array(), $methodType),
389 array(true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', array(), $methodType),
392 // add the same tests for the any type
393 foreach ($tests as $test) {
394 if ($anyType !== $test[5]) {
400 $methodAndPropObject = new Twig_TemplateMethodAndPropObject();
402 // additional method tests
403 $tests = array_merge($tests, array(
404 array(true, 'a', $methodAndPropObject, 'a', array(), $anyType),
405 array(true, 'a', $methodAndPropObject, 'a', array(), $methodType),
406 array(false, null, $methodAndPropObject, 'a', array(), $arrayType),
408 array(true, 'b_prop', $methodAndPropObject, 'b', array(), $anyType),
409 array(true, 'b', $methodAndPropObject, 'B', array(), $anyType),
410 array(true, 'b', $methodAndPropObject, 'b', array(), $methodType),
411 array(true, 'b', $methodAndPropObject, 'B', array(), $methodType),
412 array(false, null, $methodAndPropObject, 'b', array(), $arrayType),
414 array(false, null, $methodAndPropObject, 'c', array(), $anyType),
415 array(false, null, $methodAndPropObject, 'c', array(), $methodType),
416 array(false, null, $methodAndPropObject, 'c', array(), $arrayType),
419 // tests when input is not an array or object
420 $tests = array_merge($tests, array(
421 array(false, null, 42, 'a', array(), $anyType, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'),
422 array(false, null, 'string', 'a', array(), $anyType, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'),
423 array(false, null, array(), 'a', array(), $anyType, 'Key "a" does not exist as the array is empty in "index.twig".'),
430 * @expectedException Twig_Error_Runtime
432 public function testGetIsMethods()
434 $getIsObject = new Twig_TemplateGetIsMethods();
435 $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)));
436 // first time should not create a cache for "get"
437 $this->assertNull($template->getAttribute($getIsObject, 'get'));
438 // 0 should be in the method cache now, so this should fail
439 $this->assertNull($template->getAttribute($getIsObject, 0));
443 class Twig_TemplateTest extends Twig_Template
447 public function __construct(Twig_Environment $env, $name = 'index.twig')
449 parent::__construct($env);
450 self::$cache = array();
454 public function getZero()
459 public function getEmpty()
464 public function getString()
466 return 'some_string';
469 public function getTrue()
474 public function getTemplateName()
479 public function getDebugInfo()
484 protected function doGetParent(array $context)
489 protected function doDisplay(array $context, array $blocks = array())
493 public function getAttribute($object, $item, array $arguments = array(), $type = Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
495 if (function_exists('twig_template_get_attributes')) {
496 return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
498 return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
502 public function block_name($context, array $blocks = array())
507 class Twig_TemplateArrayAccessObject implements ArrayAccess
509 protected $protected = 'protected';
511 public $attributes = array(
512 'defined' => 'defined',
522 public function offsetExists($name)
524 return array_key_exists($name, $this->attributes);
527 public function offsetGet($name)
529 return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
532 public function offsetSet($name, $value)
536 public function offsetUnset($name)
541 class Twig_TemplateMagicPropertyObject
543 public $defined = 'defined';
545 public $attributes = array(
555 protected $protected = 'protected';
557 public function __isset($name)
559 return array_key_exists($name, $this->attributes);
562 public function __get($name)
564 return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
568 class Twig_TemplateMagicPropertyObjectWithException
570 public function __isset($key)
572 throw new Exception('Hey! Don\'t try to isset me!');
576 class Twig_TemplatePropertyObject
578 public $defined = 'defined';
584 protected $protected = 'protected';
587 class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements IteratorAggregate
589 public function getIterator()
591 return new ArrayIterator(array('foo', 'bar'));
595 class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements ArrayAccess
597 private $data = array(
598 'defined' => 'defined',
605 public function offsetExists($offset)
607 return array_key_exists($offset, $this->data);
610 public function offsetGet($offset)
612 return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a';
615 public function offsetSet($offset, $value)
619 public function offsetUnset($offset)
624 class Twig_TemplatePropertyObjectDefinedWithUndefinedValue
628 public function __construct()
630 $this->foo = @$notExist;
634 class Twig_TemplateMethodObject
636 public function getDefined()
641 public function get1()
646 public function get09()
651 public function getZero()
656 public function getNull()
660 public function isBar()
665 public function isBaz()
667 return 'should never be returned';
670 public function getBaz()
675 protected function getProtected()
680 public static function getStatic()
686 class Twig_TemplateGetIsMethods
688 public function get()
697 class Twig_TemplateMethodAndPropObject
699 private $a = 'a_prop';
701 public function getA()
706 public $b = 'b_prop';
708 public function getB()
713 private $c = 'c_prop';
715 private function getC()
721 class Twig_TemplateMagicMethodObject
723 public function __call($method, $arguments)
725 return '__call_'.$method;
729 class Twig_TemplateMagicMethodExceptionObject
731 public function __call($method, $arguments)
733 throw new BadMethodCallException(sprintf('Unknown method "%s".', $method));
737 class CExtDisablingNodeVisitor implements Twig_NodeVisitorInterface
739 public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
741 if ($node instanceof Twig_Node_Expression_GetAttr) {
742 $node->setAttribute('disable_c_ext', true);
748 public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
753 public function getPriority()
759 // to be removed in 2.0
760 interface Twig_TemplateTestLoaderInterface extends Twig_LoaderInterface, Twig_SourceContextLoaderInterface