Commit Graph

6528 Commits

Author SHA1 Message Date
Fabien Potencier 2e8de1d110 Make loop.last always available 2024-07-11 12:08:50 +02:00
Fabien Potencier aa80f21239 minor #4133 Simplify Loop code (fabpot)
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
2024-07-11 12:06:17 +02:00
Fabien Potencier 437ad31dfa Move some code to LoopContext 2024-07-11 09:35:26 +02:00
Fabien Potencier 0c2a69ceb3 Simplify Loop code 2024-07-11 08:47:22 +02:00
Fabien Potencier d1a13da220 feature #4131 Introduce a Loop object (fabpot)
This PR was merged into the 4.x branch.

Discussion
----------

Introduce a Loop object

Fixes #4096

Commits
-------

17ef0bef Introduce a Loop object
2024-07-11 08:04:14 +02:00
Fabien Potencier 17ef0bef4b Introduce a Loop object 2024-07-11 08:03:08 +02:00
Fabien Potencier c40faf766b Merge branch '3.x' into 4.x
* 3.x:
  Add more tests
2024-07-09 10:24:05 +02:00
Fabien Potencier 03fa665cd5 minor #4130 Add more tests (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add more tests

Commits
-------

133cbb77 Add more tests
2024-07-09 10:23:57 +02:00
Fabien Potencier 133cbb7753 Add more tests 2024-07-09 10:19:44 +02:00
Fabien Potencier da83393bc1 Merge branch '3.x' into 4.x
* 3.x:
  Fix markup
2024-07-09 09:14:04 +02:00
Fabien Potencier 13b9afae96 minor #4128 Fix markup in docs (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix markup in docs

Commits
-------

1c6f44e0 Fix markup
2024-07-09 09:13:53 +02:00
Fabien Potencier 4ae84b5bdb Merge branch '3.x' into 4.x
* 3.x:
  fix grammar for article
  [Doc] Add missing Token types
2024-07-08 15:48:57 +02:00
Fabien Potencier 1c6f44e095 Fix markup 2024-07-08 14:32:51 +02:00
Fabien Potencier 1ac1645d52 minor #4126 fix grammar for article (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

fix grammar for article

Commits
-------

d54d8438 fix grammar for article
2024-07-08 08:53:43 +02:00
Christian Flothmann d54d8438a5 fix grammar for article 2024-07-07 23:44:32 +02:00
Fabien Potencier 27fcfe0cfa minor #4125 [Doc] Add missing Token types (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

[Doc] Add missing Token types

* Token::ARROW_TYPE
* Token::SPREAD_TYPE

Commits
-------

17f7ee34 [Doc] Add missing Token types
2024-07-07 21:36:08 +02:00
Simon André 17f7ee34df [Doc] Add missing Token types
* Document Token::OPERATOR_TYPE
* Token::SPREAD_TYPE
2024-07-07 13:04:07 +02:00
Fabien Potencier 9acc085110 Merge branch '3.x' into 4.x
* 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
2024-07-06 10:46:01 +02:00
Fabien Potencier edf489831b minor #4121 fix the set of installed packages for TwigExtraBundle on PHP 8.0 (xabbuh)
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
2024-07-06 10:45:09 +02:00
Fabien Potencier f9a102b79c minor #4122 fix condition for running use_yield test with extra packages (xabbuh)
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
2024-07-06 09:38:24 +02:00
Fabien Potencier 96757908f8 minor #4120 simplify an iterable check (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

simplify an iterable check

Commits
-------

8602b7f3 simplify an iterable check
2024-07-06 09:33:23 +02:00
Christian Flothmann 07967dea80 fix condition for running use_yield test with extra packages 2024-07-05 23:56:22 +02:00
Christian Flothmann c79c7e7a09 fix the set of installed packages for TwigExtraBundle on PHP 8.0 2024-07-05 23:50:30 +02:00
Christian Flothmann 8602b7f3dc simplify an iterable check 2024-07-05 23:09:31 +02:00
Fabien Potencier 3c7514ef86 feature #3966 [templates] add shuffle filter (Sarah-eit, fabpot)
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
2024-07-05 09:41:23 +02:00
Fabien Potencier f21cb5a6c2 Fixed typo 2024-07-05 09:40:27 +02:00
Fabien Potencier 2dacaadd98 Tweak code, tests, and docs for shuffle 2024-07-05 09:39:44 +02:00
sarah-eit 17430ae5ac Add shuffle filter 2024-07-05 09:20:37 +02:00
Fabien Potencier 90d3b52c5c feature #4075 Make Environment::getGlobals() private (fabpot)
This PR was merged into the 4.x branch.

Discussion
----------

Make Environment::getGlobals() private

Commits
-------

6f4e6e7b Make Environment::getGlobals() private
2024-07-05 08:09:38 +02:00
Fabien Potencier 6f4e6e7b8e Make Environment::getGlobals() private 2024-07-05 08:05:37 +02:00
Fabien Potencier c33386a86d Merge branch '3.x' into 4.x
* 3.x:
  Add missing reference in docs
2024-07-05 08:05:09 +02:00
Fabien Potencier b37417972c Add missing reference in docs 2024-07-05 08:05:05 +02:00
Fabien Potencier b621b4473e Remove versionadded in docs 2024-07-05 08:01:53 +02:00
Fabien Potencier 0f76a81b10 Merge branch '3.x' into 4.x
* 3.x:
  Fix tests
  Tweak code and docs
  feat(string-extra): Add singularize and pluralize filter
2024-07-05 08:00:46 +02:00
Fabien Potencier 82d31319bb Fix tests 2024-07-05 07:59:36 +02:00
Fabien Potencier 0bbe173d29 feature #4107 [String] Add singularize and pluralize filter (welcoMattic, fabpot)
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
2024-07-05 07:54:10 +02:00
Fabien Potencier 8c969d403c Tweak code and docs 2024-07-04 08:17:15 +02:00
Mathieu Santostefano cb392489c3 feat(string-extra): Add singularize and pluralize filter 2024-07-02 22:44:09 +02:00
Fabien Potencier cc7c08592d Merge branch '3.x' into 4.x
* 3.x:
  [Doc] Replace http links with https
  [Doc] Modernize Class name in examples
2024-07-02 08:11:16 +02:00
Fabien Potencier e4835b189f minor #4116 [Doc] Modernize Class name in examples (smnandre)
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
2024-07-02 08:11:03 +02:00
Fabien Potencier b6360fbae3 minor #4117 [Doc] Replace http links with https (smnandre)
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
2024-07-02 08:10:01 +02:00
Simon André ae429bd51d [Doc] Replace http links with https 2024-07-02 08:09:58 +02:00
Fabien Potencier 3734ba6a17 Merge branch '3.x' into 4.x
* 3.x:
  Remove usage of uniqid
  Document OPTIMIZE_TEXT_NODES
  Issue #3828: Add sequence and mapping tests
2024-07-01 18:45:00 +02:00
Fabien Potencier a2f5d49126 minor #4118 Remove usage of uniqid (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Remove usage of uniqid

Commits
-------

2f8219e6 Remove usage of uniqid
2024-07-01 18:43:37 +02:00
Fabien Potencier 2f8219e691 Remove usage of uniqid 2024-07-01 18:40:58 +02:00
Fabien Potencier cd2f7f2521 minor #4115 [Doc] Document OPTIMIZE_TEXT_NODES (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

[Doc] Document OPTIMIZE_TEXT_NODES

(and remove obselete OPTIMIZE_VAR_ACCESS)

Commits
-------

491a8417 Document OPTIMIZE_TEXT_NODES
2024-07-01 14:33:44 +02:00
Simon André 4a8e8ee16b [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"
2024-06-30 10:31:01 +02:00
Simon André 491a84175d Document OPTIMIZE_TEXT_NODES
(and remove obselete OPTIMIZE_VAR_ACCESS)
2024-06-30 10:13:10 +02:00
Fabien Potencier 045f5adec7 feature #3859 Issue #3828: Add sequence and mapping tests (pdureau)
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
2024-06-22 19:49:10 +02:00
Pierre c5c95a2d5c Issue #3828: Add sequence and mapping tests 2024-06-22 19:48:59 +02:00