This PR was squashed before being merged into the 4.x branch.
Discussion
----------
Simplify Loop code
Let's compute values as late as possible.
Commits
-------
437ad31d Move some code to LoopContext
0c2a69ce Simplify Loop code
* 3.x:
fix condition for running use_yield test with extra packages
fix the set of installed packages for TwigExtraBundle on PHP 8.0
simplify an iterable check
Fixed typo
Tweak code, tests, and docs for shuffle
Add shuffle filter
This PR was merged into the 3.x branch.
Discussion
----------
fix the set of installed packages for TwigExtraBundle on PHP 8.0
Prevents symfony/translation-contracts 3 to be installed together with symfony/string 5.4.0-RC1 (see https://github.com/twigphp/Twig/actions/runs/9804849131/job/27073398023#step:8:117). Stable releases of the String component don't suffer from this incompatibility because of symfony/symfony#44246.
Commits
-------
c79c7e7a fix the set of installed packages for TwigExtraBundle on PHP 8.0
This PR was merged into the 3.x branch.
Discussion
----------
fix condition for running use_yield test with extra packages
Commits
-------
07967dea fix condition for running use_yield test with extra packages
This PR was merged into the 3.x branch.
Discussion
----------
[templates] add shuffle filter
New feature :
The filter displays the values in an array at random.
I'm open of any feedback.
Commits
-------
2dacaadd Tweak code, tests, and docs for shuffle
17430ae5 Add shuffle filter
This PR was merged into the 4.x branch.
Discussion
----------
Make Environment::getGlobals() private
Commits
-------
6f4e6e7b Make Environment::getGlobals() private
This PR was merged into the 3.x branch.
Discussion
----------
[String] Add singularize and pluralize filter
This PR follows up this one in Symfony https://github.com/symfony/symfony/pull/57245.
It adds 2 new filters `singularize` and `pluralize`. It uses the String component, especially `EnglishInflector` and `FrenchInflector`.
Examples:
```php
{{ 'person'|pluralize('en') }} // persons
{{ 'person'|pluralize('en', false) }} // ['persons', 'people']
{{ 'personne'|pluralize('fr') }} // personnes
{{ 'personne'|pluralize('fr', false) }} // ['personnes']
{{ 'persons'|singluarize('en') }} // person
{{ 'people'|singluarize('en') }} // person
{{ 'persons'|singluarize('en', false) }} // ['person']
{{ 'personnes'|singluarize('fr') }} // personne
{{ 'personnes'|singluarize('fr', false) }} // ['personne']
{{ 'persona'|pluralize('it') }} // \InvalidArgumentException('Language "it" is not supported.')
{{ 'persone'|singluarize('it') }} // \InvalidArgumentException('Language "it" is not supported.')
```
Commits
-------
8c969d40 Tweak code and docs
cb392489 feat(string-extra): Add singularize and pluralize filter
This PR was merged into the 3.x branch.
Discussion
----------
[Doc] Modernize Class name in examples
From "Project_Twig_Extension" to "CustomExtension"
Just a suggestion, feel free to close if you want to keep it like this :)
I found those namings only in "advanced"
Commits
-------
4a8e8ee1 [Doc] Modernize Class name in examples
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
[Doc] Replace http links with https
Commits
-------
ae429bd5 [Doc] Replace http links with https
From "Project_Twig_Extension" to "CustomExtension"
Just a suggestion, feel free to close if you want to keep it like this :)
I found those namings only in "advanced"
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Issue #3828: Add sequence and mapping tests
Add sequence and mapping tests from Jinja.
Commits
-------
c5c95a2d Issue #3828: Add sequence and mapping tests