Commit Graph

7160 Commits

Author SHA1 Message Date
Christian Flothmann 4c818122f3 fix typo 2025-02-18 15:14:50 +01:00
Fabien Potencier 0f569b8297 minor #4584 fix the rst syntax of the operator precedence table (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

fix the rst syntax of the operator precedence table

Commits
-------

a544dc8b33 fix the rst syntax of the operator precedence table
2025-02-17 09:28:16 +01:00
Christian Flothmann a544dc8b33 fix the rst syntax of the operator precedence table 2025-02-16 22:36:01 +01:00
Fabien Potencier 576b4126a6 minor #4582 re-add mixed return type (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

re-add mixed return type

see https://github.com/twigphp/Twig/pull/4581#discussion_r1956080587 and https://github.com/symfony/symfony/actions/runs/13329105184/job/37228898654?pr=59776#step:8:2832

Commits
-------

5f6c67f838 re-add mixed return type
2025-02-14 14:06:59 +01:00
Christian Flothmann 5f6c67f838 re-add mixed return type 2025-02-14 13:47:07 +01:00
Fabien Potencier cfeb51b67f minor #4581 Fix CS (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix CS

Commits
-------

151aa4ecda Fix CS
2025-02-14 12:59:29 +01:00
Fabien Potencier 151aa4ecda Fix CS 2025-02-14 12:57:03 +01:00
Fabien Potencier 640b382a51 feature #4580 Add a proper prefix spread operator (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a proper prefix spread operator

Now that 3.x has bumped the PHP min version to 8.1, we can move the spread operator to a real one.

Commits
-------

3964aeba78 Add a proper prefix spread operator
2025-02-14 12:46:44 +01:00
Fabien Potencier 3964aeba78 Add a proper prefix spread operator 2025-02-14 11:45:39 +01:00
Fabien Potencier 2f3150579f minor #4578 Avoid storing expression parser instances in Node attributes (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Avoid storing expression parser instances in Node attributes

That avoids polluting Node instances and exposing a purely internal state.

Commits
-------

d6f539bb01 Avoid storing expression parser instances in Node attributes
2025-02-14 11:36:16 +01:00
Fabien Potencier 20e677b6c9 Fix docs 2025-02-14 11:33:18 +01:00
Fabien Potencier d6f539bb01 Avoid storing expression parser instances in Node attributes 2025-02-14 11:32:12 +01:00
Fabien Potencier 613d6b9498 bug #4579 Fix cache-extra impl (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix cache-extra impl

Commits
-------

4695e33f73 Fix cache-extra impl
2025-02-14 11:30:33 +01:00
Fabien Potencier 4695e33f73 Fix cache-extra impl 2025-02-14 11:27:48 +01:00
Fabien Potencier 1ea5ac600d feature #4543 Move operator definitions to objects (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Move operator definitions to objects

Commits
-------

79d828b09d Fix version
251c0b5da9 Fix CS
561c6629e1 Remove obsolete code
4b57f48a65 Use generics in ExpressionParsers
8ff19090f3 Fix precedence rules
0cb5c0e8d0 Add deprecation notices in CHANGELOG and docs
f67078b5c4 Move Operators to ExpressionParsers, deprecate ExpressionParser
9334a7064a Add a script to update operator precedence documentation
42c82e1e9b Extract operators logic from ExpressionParser to their own classes
df877a1d53 Introduce operator classes to describe operators provided by extensions instead of arrays
2025-02-14 08:51:09 +01:00
Fabien Potencier 79d828b09d Fix version 2025-02-14 08:47:54 +01:00
Fabien Potencier 251c0b5da9 Fix CS 2025-02-14 08:45:28 +01:00
Fabien Potencier 561c6629e1 Remove obsolete code 2025-02-14 08:38:53 +01:00
Fabien Potencier 4b57f48a65 Use generics in ExpressionParsers 2025-02-14 08:38:53 +01:00
Fabien Potencier 8ff19090f3 Fix precedence rules 2025-02-14 08:38:53 +01:00
Fabien Potencier 0cb5c0e8d0 Add deprecation notices in CHANGELOG and docs 2025-02-14 08:38:53 +01:00
Fabien Potencier f67078b5c4 Move Operators to ExpressionParsers, deprecate ExpressionParser 2025-02-14 08:38:53 +01:00
Fabien Potencier 9334a7064a Add a script to update operator precedence documentation 2025-02-14 08:38:53 +01:00
Fabien Potencier 42c82e1e9b Extract operators logic from ExpressionParser to their own classes 2025-02-14 08:38:53 +01:00
Fabien Potencier df877a1d53 Introduce operator classes to describe operators provided by extensions instead of arrays 2025-02-14 08:38:53 +01:00
Fabien Potencier 229f54f8cf Bump version to 3.21 2025-02-14 08:36:54 +01:00
Fabien Potencier 586e3decdd Bump version 2025-02-13 09:35:50 +01:00
Fabien Potencier 3468920399 Prepare the 3.20.0 release v3.20.0 2025-02-13 09:34:43 +01:00
Fabien Potencier e456a3189b Update CHANGELOG 2025-02-13 09:34:02 +01:00
Fabien Potencier f1c9039106 Fix typo 2025-02-09 18:38:06 +01:00
Fabien Potencier d1737bd894 Fix CHANGELOG 2025-02-09 18:11:45 +01:00
Fabien Potencier 6508e80d50 bug #4575 Fix support for ignoring syntax erros in an undefined handler in guard (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Fix support for ignoring syntax erros in an undefined handler in guard

This fixes the issue discussed in https://github.com/twigphp/Twig/pull/4511#issuecomment-2598774060 so that ignoring SyntaxError from undefined handlers wanting to provide a custom message actually works in the `{% guard %}` tag.

This adds an integration test covering that behavior to ensure it works.

Commits
-------

3794efe662 Fix support for ignoring syntax erros in an undefined handler in guard
2025-02-09 18:11:12 +01:00
Christophe Coevoet 3794efe662 Fix support for ignoring syntax erros in an undefined handler in guard 2025-02-09 15:10:34 +01:00
Fabien Potencier 40a2d5b57f Add missing CHANGELOG 2025-02-08 10:47:15 +01:00
Fabien Potencier 3cdf26fe76 feature #3737 Added configuration for commonmark use in twig-extra-bundle. (doekenorg)
This PR was merged into the 3.x branch.

Discussion
----------

Added configuration for commonmark use in twig-extra-bundle.

Following this tweet: https://twitter.com/ramsey/status/1561894460560138241, this PR adds the configuration options for `commonmark` to the `twig-extra-bundle`.

The configuration is added to the `LeagueCommonMarkConverterFactory` and in turn injected in the `CommonMarkConverter`. This way a user can provide the configuration for usage inside twig.

I'm not sure if adding the configuration inside the extension is the way to go.

Hope this helps out at least `@ramsey` :-)

Added `ignoreExtraKeys` to be somewhat future proof in case extra configuration is added later on, and also to be able to provide de configuration for extensions.

Commits
-------

6f20629622 Added configuration for commonmark use in twig-extra-bundle.
2025-02-08 10:44:24 +01:00
Fabien Potencier fab1a37d8e bug #4546 Fix timezone conversion on strings (PrinsFrank)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix timezone conversion on strings

When setting a default application timezone, and a display timezone:
```php
date_default_timezone_set('UTC');
$twig->getExtension(\Twig\Extension\CoreExtension::class)->setTimezone('Europe/Paris');
```

Date objects get converted, but strings don't. See #4545.

For most other paths in `convertDate`, the dateTime object is initialized, and afterwards the timezone gets set. For strings, the timezone is passed as a constructor argument before having the timezone set again, losing its converting behaviour. This makes the convertDate method work identical for DateTime objects as strings. This different behaviour was already spotted in #3568.

Fixes #4545 #3568 #2819

Commits
-------

f69531fa00 Fix timezone conversion on strings
2025-02-07 22:52:13 +01:00
PrinsFrank f69531fa00 Fix timezone conversion on strings 2025-02-07 22:52:10 +01:00
Fabien Potencier 7f12e871af bug #4572 Use correct lineno for ForElseNode (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Use correct lineno for ForElseNode

It should take the line number of the `{% else %}` block.

Commits
-------

a84e602b4f Use correct lineno for ForElseNode
2025-02-07 15:19:42 +01:00
Ruud Kamphuis a84e602b4f Use correct lineno for ForElseNode
It should take the line number of the `{% else %}` block.
2025-02-07 14:48:08 +01:00
Fabien Potencier 8432946eee feature #4571 Add support for registered undefined element callbacks in tests (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Add support for registered undefined element callbacks in tests

This also defines the proper type for the callable arguments in those methods, allowing to know the expected signature (and allowing static analysis tools to check it) instead of having to inspect the implementation to see how those callables are used.

Commits
-------

198fc1a9f9 Add support for registered undefined element callbacks in tests
2025-02-04 12:35:15 +01:00
Christophe Coevoet 198fc1a9f9 Add support for registered undefined element callbacks in tests 2025-02-04 10:28:21 +01:00
Fabien Potencier 9157c1686c minor #4570 Add UnaryInterface (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add UnaryInterface

Commits
-------

9ccca47b8a Add UnaryInterface
2025-02-03 21:25:09 +01:00
Fabien Potencier 9ccca47b8a Add UnaryInterface 2025-02-03 21:23:35 +01:00
Fabien Potencier 462eedd43f minor #4569 Add BinaryInterface (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add BinaryInterface

`@stof` That's what you had in mind for https://github.com/twigphp/Twig/pull/4543#discussion_r1939732064?

Commits
-------

fa1ffb5b29 Add BinaryInterface
2025-02-03 21:16:08 +01:00
Fabien Potencier fa1ffb5b29 Add BinaryInterface 2025-02-03 19:21:18 +01:00
Fabien Potencier 2cc081da2c minor #4568 Reimplement the cache tag in an adhoc way (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Reimplement the cache tag in an adhoc way

Commits
-------

3288d8d98d Reimplement the cache tag in an adhoc way
2025-02-03 13:13:59 +01:00
Fabien Potencier 3288d8d98d Reimplement the cache tag in an adhoc way 2025-02-03 12:49:20 +01:00
Fabien Potencier af5f4c34fb Fix CS 2025-02-03 08:48:19 +01:00
Fabien Potencier 3f9974e688 bug #4567 Fix wrong array index (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix wrong array index

Commits
-------

7f080086dc Fix wrong array index
2025-02-01 16:24:04 +01:00
Fabien Potencier 7f080086dc Fix wrong array index 2025-02-01 16:22:20 +01:00