Merge branch '3.x' into 4.x

* 3.x:
  Fix testing and expression when it evaluates to an instance of Markup
  Simplify Error implementation
  Make the defined test implementation more generic
  fix typo
  fix the rst syntax of the operator precedence table
This commit is contained in:
Fabien Potencier
2025-02-21 18:55:21 +01:00
57 changed files with 500 additions and 180 deletions
@@ -32,7 +32,7 @@ class ContextVariableTest extends NodeTestCase
$node = new ContextVariable($special, 1);
yield $special => [$node, "// line 1\n$compiled"];
$node = new ContextVariable($special, 1);
$node->setAttribute('is_defined_test', true);
$node->enableDefinedTest();
yield $special.'_defined_test' => [$node, "// line 1\ntrue"];
}
@@ -59,13 +59,13 @@ class ContextVariableTest extends NodeTestCase
// is defined test
$node = new ContextVariable('foo', 1);
$node->setAttribute('is_defined_test', true);
$node->enableDefinedTest();
yield 'is_defined_test_strict' => [$node, "// line 1\narray_key_exists(\"foo\", \$context)", $envStrict];
yield 'is_defined_test_non_strict' => [$node, "// line 1\narray_key_exists(\"foo\", \$context)", $env];
// is defined test // always defined
$node = new ContextVariable('foo', 1);
$node->setAttribute('is_defined_test', true);
$node->enableDefinedTest();
$node->setAttribute('always_defined', true);
yield 'is_defined_test_always_defined_strict' => [$node, "// line 1\ntrue", $envStrict];
yield 'is_defined_test_always_defined_non_strict' => [$node, "// line 1\ntrue", $env];