This PR was merged into the 2.x branch.
Discussion
----------
Allow symfony/translation-contracts:^3
However,
I am just wondering why this dependency is required since it's not used anywhere in `twig/string-extra`? Or I am wrong ?
Closing https://github.com/twigphp/Twig/issues/3607
Commits
-------
0c1e4edc allow translation-contracts:^3
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
Optimize Environment::resolveTemplate() to be much faster when template overrides do not exist
Fixes partially #3595.
You can test this by adding an object into the context which implements `__debugInfo()` with a counter in it. Make a template with
```twig
{% include ['missing_template1', 'missing_template2', 'missing_template3', 'missing_template4', 'missing_template5'] %}
```
And check how many times an exception was thrown by reading the counter. The issue gets exponentially worse if you have nested templates with overrides in each of them.
Commits
-------
695423e1 Optimize Environment::resolveTemplate() to be much faster when template overrides do not exist
This PR was merged into the 2.x branch.
Discussion
----------
Use faster hash algorithm (xxh128) on PHP 8.1+
Twig uses the `hash` function at runtime to convert template paths class names, each time a template is loaded. In a large project with a high granularity of templates (hundreds of `include` per page), this can become the most time consuming function as reported by Blackfire:
<img src="https://user-images.githubusercontent.com/400034/140626949-c4876b7d-c91c-4e07-b2f4-8ebbcaa72f61.png" width="220">
To optimise this use-case, [PHP 8.1 supports the xxHash hash algorithms](https://php.watch/versions/8.1/xxHash). `xxh128` is 60x faster that `sha256` according to the [benchmarks](https://php.watch/articles/php-hash-benchmark), and guarantee a very [low risk of collision](http://cyan4973.github.io/xxHash/).
I'm not able to test with PHP 8.1 for now. Before going further I would like to validate performance impact on a large list of file names.
Commits
-------
4fcc6b1c Use faster hash algorithm (xxh128) on PHP 8.1
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
Hashing is not necessary to generate unique variable names during compilation
Trying to optimize calls to `hash` function (#3588), I found that some calls are made during compilation that are not necessary at all.
According to the last commits on this functions (57ff88255e & 6ab5fe9b8f), the internal variable names must be unique and deterministic. Using a simple sequence is enough.
This avoid CPU cycles during compilation. Which should not have any impact on production; but still interesting for dev&test.
Commits
-------
ba2b4e6d Hashing is not necessary to generate unique variable names during compilation
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.
Discussion
----------
Fix a typo advanced.rst
Fix a typo
Commits
-------
cd24fb57 Fix a typo advanced.rst
This PR was merged into the 2.x branch.
Discussion
----------
[TwigExtraBundle] Add the return type information in getConfigTreeBuilder()
Moved from https://github.com/twigphp/twig-extra-bundle/pull/5
-----
This will fix the following deprecation:
```
1x: Method "Symfony\Component\Config\Definition\ConfigurationInterface::getConfigTreeBuilder()" might add "TreeBuilder" as a native return type declaration in the future. Do the same in implementation "Twig\Extra\TwigExtraBundle\DependencyInjection\Configuration" now to avoid errors or add an explicit `@return` annotation to suppress this message.
1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command
```
Commits
-------
26654f65 [TwigExtraBundle] Add the return type information in getConfigTreeBuilder()
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead.
Discussion
----------
Fix emphasis on compiler to bold styling
This is just so the Lexer, Parser, and Compiler has the same styling
Commits
-------
97ae3c8e Fix emphasis on compiler to bold styling
This PR was submitted for the 3.x branch but it was squashed and merged into the 1.x branch instead.
Discussion
----------
Update .gitattributes to exclude non-dist files
resolves#3503
some extra files can be excluded also:
- changelog
- license
- readme
should this be rebased to 1.x, 2.x?
Commits
-------
92766d0e Update .gitattributes to exclude non-dist files
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.
Discussion
----------
Update markdown-to-html converter missing message
The `league/html-to-markdown` library does not support Markdown to HTML conversion (anymore?). The `league/commonmark` library is suitable for that.
Commits
-------
46d21545 Update markdown-to-html converter missing message
This PR was merged into the 1.x branch.
Discussion
----------
Missing Environment and LoaderInterface
Detected by CI...
Commits
-------
61df934a Missing Environment and LoaderInterface
This PR was merged into the 2.x branch.
Discussion
----------
Add explicit ``@return`` type next to `#[ReturnTypeWillChange]`
Commits
-------
1d0bab9d Add explicit ``@return`` type next to `#[ReturnTypeWillChange]`
This PR was merged into the 2.x branch.
Discussion
----------
Twig2 PHP 8.1 beta compatibility
PHP 8.1 adds deprecation warnings for \IteratorAggregate \Countable and \ArrayAccess and Twig 2 (and 3) need to be updated for this.
Commits
-------
98c2233e Twig2 PHP 8.1 beta compatibility