From d3c3c605d53f2c41cc922aaac261f129490539d1 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 23 Jan 2016 11:22:22 +0100 Subject: [PATCH] add hasser support to getAttribute() --- doc/templates.rst | 1 + ext/twig/twig.c | 5 +++++ lib/Twig/Template.php | 2 ++ test/Twig/Tests/TemplateTest.php | 10 ++++++++++ 4 files changed, 18 insertions(+) diff --git a/doc/templates.rst b/doc/templates.rst index 65eeb431a7..dbf0bb5e9f 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -110,6 +110,7 @@ is set, Twig will throw an error (see :ref:`environment options null, '1' => 1, 'bar' => true, + 'foo' => true, '09' => '09', '+4' => '+4', ); @@ -314,6 +315,7 @@ public function getGetAttributeTests() array(true, 1, 1.0), array(true, null, 'null'), array(true, true, 'bar'), + array(true, true, 'foo'), array(true, '09', '09'), array(true, '+4', '+4'), ); @@ -483,6 +485,7 @@ class Twig_TemplateArrayAccessObject implements ArrayAccess 'null' => null, '1' => 1, 'bar' => true, + 'foo' => true, '09' => '09', '+4' => '+4', ); @@ -515,6 +518,7 @@ class Twig_TemplateMagicPropertyObject 'null' => null, '1' => 1, 'bar' => true, + 'foo' => true, '09' => '09', '+4' => '+4', ); @@ -546,6 +550,7 @@ class Twig_TemplatePropertyObject public $zero = 0; public $null = null; public $bar = true; + public $foo = true; protected $protected = 'protected'; } @@ -622,6 +627,11 @@ public function isBar() return true; } + public function hasFoo() + { + return true; + } + protected function getProtected() { return 'protected';