Skip to content

Commit 7b0255d

Browse files
committed
Don't break GetAttrExpression::$definedTest
1 parent dcc5165 commit 7b0255d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/web/twig/nodes/GetAttrNode.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Twig\Compiler;
1212
use Twig\Extension\SandboxExtension;
1313
use Twig\Node\Expression\GetAttrExpression;
14-
use Twig\Node\Expression\SupportDefinedTestTrait;
1514
use Twig\Node\Node;
1615
use Twig\Template;
1716

@@ -24,8 +23,6 @@
2423
*/
2524
class GetAttrNode extends GetAttrExpression
2625
{
27-
use SupportDefinedTestTrait;
28-
2926
/**
3027
* @param array $nodes An array of named nodes
3128
* @param array $attributes An array of attributes (should not be nodes)
@@ -53,7 +50,7 @@ public function compile(Compiler $compiler): void
5350
if (
5451
$this->getAttribute('optimizable')
5552
&& (!$env->isStrictVariables() || $this->getAttribute('ignore_strict_check'))
56-
&& !$this->definedTest
53+
&& !$this->isDefinedTestEnabled() // DIFF: $this->definedTest is private
5754
&& Template::ARRAY_CALL === $this->getAttribute('type')
5855
) {
5956
$var = '$' . $compiler->getVarName();
@@ -113,7 +110,7 @@ public function compile(Compiler $compiler): void
113110

114111
$compiler->raw(', ')
115112
->repr($this->getAttribute('type'))
116-
->raw(', ')->repr($this->definedTest)
113+
->raw(', ')->repr($this->isDefinedTestEnabled()) // DIFF: $this->definedTest is private
117114
->raw(', ')->repr($this->getAttribute('ignore_strict_check'))
118115
->raw(', ')->repr($env->hasExtension(SandboxExtension::class))
119116
->raw(', ')->repr($this->getNode('node')->getTemplateLine())

0 commit comments

Comments
 (0)