Twig
Twig copied to clipboard
Twig, the flexible, fast, and secure template language for PHP
This is my last attempt to add support for PHPUnit 11 for Twig 3. This pull request adds new test methods that only runs in PHPUnit >= 11 and makes...
This is the simplest useful node visitor that use the new types information to optimize the compiled code.
### Current situation Currently, adding a `-` to a twig tag causes whitespace removal. E.g. `{#- some comment #}`, here whitespace is removed before but not after the comment. Without...
The doc/templates.rst states: "... default removal of the first newline inherited from PHP". What are you talking about? Where PHP removes the first newline? I cannot google up anything like...
Adds native support for Twig’s null-safe `?.` operator so templates can traverse objects and arrays without defensive plumbing: `{{ user?.address?.city }}` now renders the value when present and stays silent...
`{{ false|default(true) }}` gives true, since `default()` obviously treats `false` just like `null` or undefined. It's documented at https://twig.symfony.com/doc/3.x/filters/default.html, but still weird ;-) I just wanted to add this to...
While upgrading twig v1.30 to v3.22.0 i encountered some problem using macros from an external file and calling them by using a variable value as dynamic name. When using V1.30,...
In many compiled templates I see this instruction: ```php $context = array_intersect_key($context, $_parent) + $_parent; ``` Problem is that many times that variable at the very end of some method...
The `getOperators` method is [marked as deprecated](https://github.com/twigphp/Twig/blob/3.x/doc/deprecated.rst?plain=1#L454) in the [code base](https://github.com/twigphp/Twig/blob/3.x/src/ExtensionSet.php#L534), but [the official documentation](https://twig.symfony.com/doc/3.x/advanced.html#operators) lists this method as the only way to add new operators.