if ($node instanceof AutoEscapeNode ||
$node instanceof BlockNode
) { array_pop($this->statusStack
);
} elseif ($node instanceof BlockReferenceNode
) { $this->blocks
[$node->
getAttribute('name'
)] =
$this->
needEscaping($env);
} return $node;
} private function shouldUnwrapConditional(ConditionalExpression
$expression, Environment
$env, string
$type): bool
{ $expr2Safe =
$this->
isSafeFor($type,
$expression->
getNode('expr2'
),
$env);
$expr3Safe =
$this->
isSafeFor($type,
$expression->
getNode('expr3'
),
$env);
return $expr2Safe !==
$expr3Safe;
} private function unwrapConditional(ConditionalExpression
$expression, Environment
$env, string
$type): ConditionalExpression
{ // convert "echo a ? b : c" to "a ? echo b : echo c" recursively
$expr2 =
$expression->
getNode('expr2'
);
if ($expr2 instanceof ConditionalExpression &&
$this->
shouldUnwrapConditional($expr2,
$env,
$type)) { $expr2 =
$this->
unwrapConditional($expr2,
$env,
$type);
}