Commit Graph

6496 Commits

Author SHA1 Message Date
Fabien Potencier 8a8f22131c Simplify tests 2024-08-10 18:25:26 +02:00
Fabien Potencier ff337fe45c feature #4192 Add the notion of a Twig callable (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add the notion of a Twig callable

Commits
-------

84bc23af Add the notion of a Twig callable
2024-08-10 17:56:11 +02:00
Fabien Potencier 84bc23af93 Add the notion of a Twig callable 2024-08-10 17:55:26 +02:00
Fabien Potencier c2dd532c72 feature #4191 Drop support for 8.0 (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Drop support for 8.0

The most recent version of PHP 7 (7.4) was deprecated more than a year and a half ago.

We won't remove code that supports PHP 7 (as this has already been done in 4.x and there is no point in redoing the work in the 3.x branch), but we will use some new PHP 8 features in the 3.x branch from now on.

Commits
-------

c070cd71 Drop support for 8.0
2024-08-10 12:42:38 +02:00
Fabien Potencier c070cd719c Drop support for 8.0 2024-08-10 12:32:24 +02:00
Fabien Potencier 1870a61773 minor #4190 Add more tests to the Lexer (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add more tests to the Lexer

Commits
-------

38250b91 Add more tests to the Lexer
2024-08-10 12:19:59 +02:00
Fabien Potencier 346749b8c1 minor #4189 Add a note about how to escape a string interpolation in a string (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a note about how to escape a string interpolation in a string

Commits
-------

38e47a3e Add a note about how to escape a string interpolation in a string
2024-08-10 12:19:46 +02:00
Fabien Potencier 38250b91ca Add more tests to the Lexer 2024-08-10 12:17:25 +02:00
Fabien Potencier 38e47a3e94 Add a note about how to escape a string interpolation in a string 2024-08-10 11:32:28 +02:00
Fabien Potencier 221e62cf63 Bump version to 3.12 2024-08-10 11:01:45 +02:00
Fabien Potencier aed4990615 feature #4177 Implement the enum_cases function (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Implement the enum_cases function

The implementation contains an optimized implementation of the function for the common case of using a string literal as the argument. It will validate the enum existence during compilation and compile the code to use `MyEnum::cases()` directly.

Closes #3872 (it replaces it)
Relates to #3681 (it solves the case of getting the list of cases)

Note that the strict compile time validation for string literals is especially beneficial as long as escaping `\` is mandatory in our string literals (where escaping non-special characters is the same than not putting the backslash) as by experience, this is a common mistake when trying to put a PHP FQCN in a Twig string. One of the tests I added is covering exactly this kind of mistake.

Commits
-------

ff4d01f9 Implement the enum_cases function
2024-08-10 10:40:52 +02:00
Christophe Coevoet ff4d01f940 Implement the enum_cases function
The implementation contains an optimized implementation of the function
for the common case of using a string literal as the argument. It will
validate the enum existence during compilation and compile the code to
use `MyEnum::cases()` directly.
2024-08-09 21:21:58 +02:00
Fabien Potencier b3f953c132 bug #4187 Fix integration tests when a test has more than on data/expect section and deprecations (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix integration tests when a test has more than on data/expect section and deprecations

Fixes #4186

As deprecations are emitted at compile time, we need to make sure templates are always compiled even when we have more than one data/expect section (in which case the templates are the same). The trick here is to add some whitespace at the end of the template.

Commits
-------

a5dc02bb Fix integration tests when a test has more than on data/expect section and deprecations
2024-08-09 18:13:27 +02:00
Fabien Potencier 5550140931 Remove deprecation arg 2024-08-09 18:02:41 +02:00
Fabien Potencier a5dc02bbc5 Fix integration tests when a test has more than on data/expect section and deprecations 2024-08-09 17:14:41 +02:00
Fabien Potencier 3301b99276 Bump version 2024-08-08 18:16:11 +02:00
Fabien Potencier e80fb8ebba Prepare the 3.11.0 release v3.11.0 2024-08-08 18:15:16 +02:00
Fabien Potencier fe32121084 Update CHANGELOG 2024-08-08 18:03:04 +02:00
Fabien Potencier 0d524d3ae7 feature #4182 Add the possibility to deprecate attributes and nodes on Node (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add the possibility to deprecate attributes and nodes on Node

Commits
-------

18894cf9 Add the possibility to deprecate attributes and nodes on Node
2024-08-08 14:48:26 +02:00
Fabien Potencier 18894cf91e Add the possibility to deprecate attributes and nodes on Node 2024-08-08 14:48:20 +02:00
Fabien Potencier 90fbb9acbc feature #4183 Add support for package/version on deprecations (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add support for package/version on deprecations

Commits
-------

0ce79df5 Use trigger_deprecation() instead of trigger_error() for deprecations
2024-08-08 14:46:03 +02:00
Fabien Potencier 0ce79df5c4 Use trigger_deprecation() instead of trigger_error() for deprecations 2024-08-08 14:28:28 +02:00
Fabien Potencier 839da16d04 Tweak docs 2024-08-08 11:12:39 +02:00
Fabien Potencier 92525785d8 minor #4181 clarify that macros shadow other macros/functions (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

clarify that macros shadow other macros/functions

see https://github.com/twigphp/Twig/pull/4175#issuecomment-2273646498

Commits
-------

e1a94481 clarify that macros shadow other macros/functions
2024-08-08 10:53:25 +02:00
Christian Flothmann e1a9448190 clarify that macros shadow other macros/functions 2024-08-08 09:25:31 +02:00
Fabien Potencier 390c5a0b05 Remove debug info 2024-08-07 22:59:17 +02:00
Fabien Potencier 64d5b565d7 feature #4179 Move static attributes for Function|Filter|TestExpression to the constructor (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Move static attributes for Function|Filter|TestExpression to the constructor

Commits
-------

e8141bbd Move static attributes for Function|Filter|TestExpression to the constructor
2024-08-07 22:38:05 +02:00
Fabien Potencier e8141bbd34 Move static attributes for Function|Filter|TestExpression to the constructor 2024-08-07 22:29:43 +02:00
Fabien Potencier 15854ca9bf feature #4178 Constant expr as final (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Constant expr as final

Closes #4119

Commits
-------

230e31d3 Add a recipe about how to mark a node as safe
693693ba Mark ConstantExpression as `@final`
2024-08-07 21:01:58 +02:00
Fabien Potencier 230e31d384 Add a recipe about how to mark a node as safe 2024-08-07 21:01:18 +02:00
Fabien Potencier f5e10e10f1 Fix CS 2024-08-07 19:34:09 +02:00
Fabien Potencier 693693ba3a Mark ConstantExpression as @final 2024-08-07 19:00:30 +02:00
Fabien Potencier ea4d706da1 feature #4171 Introduce ChainCache and ReadOnlyFilesystemCache (Okhoshi)
This PR was merged into the 3.x branch.

Discussion
----------

Introduce ChainCache and ReadOnlyFilesystemCache

Following the feedback in symfony/symfony#54384, I’m proposing the two new Cache implementations in Twig directly.

Commits
-------

0dbe1d9f Introduce ChainCache and ReadOnlyFilesystemCache
2024-08-07 14:41:36 +02:00
Quentin D. 0dbe1d9f6d Introduce ChainCache and ReadOnlyFilesystemCache
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
2024-08-07 14:31:56 +02:00
Fabien Potencier 6566066fab minor #4175 Add a note about how macros can override existing functions (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a note about how macros can override existing functions

Commits
-------

cea17143 Add a note about how macros can override existing functions
2024-08-07 11:26:22 +02:00
Fabien Potencier cea1714331 Add a note about how macros can override existing functions 2024-08-07 11:25:44 +02:00
Fabien Potencier 26b1dc590c minor #4170 Fix dumping callables on Node::__toString() (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix dumping callables on Node::__toString()

Closes #3694

Commits
-------

fc644721 Fix dumping callables on Node::__toString()
2024-08-04 16:38:14 +02:00
Fabien Potencier fc64472145 Fix dumping callables on Node::__toString() 2024-08-04 16:35:01 +02:00
Fabien Potencier fa3c341725 feature #3963 Add new "find" filter (smnandre)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add new "find" filter

This filter returns the first _value_ matching the given arrow function or null

Attempt to solve #3962

(open to any feedback)

Commits
-------

4e262511 Add new "find" filter
2024-08-04 13:39:13 +02:00
Simon André 4e26251193 Add new "find" filter 2024-08-04 13:39:10 +02:00
Fabien Potencier 205ea9e300 minor #4164 Remove the templateClassPrefix property on Environment (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Remove the templateClassPrefix property on Environment

Commits
-------

215f9880 Remove the templateClassPrefix property on Environment
2024-07-31 22:48:26 +02:00
Fabien Potencier 0d09230b4b minor #4167 Fix various phpstan errors (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix various phpstan errors

Commits
-------

ae4f2840 Fix various phpstan errors
2024-07-31 09:30:45 +02:00
Fabien Potencier ae4f284043 Fix various phpstan errors 2024-07-30 11:17:22 +02:00
Fabien Potencier b566513ef1 minor #4166 [Tests] Fix EscaperRuntime namespace (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

[Tests] Fix EscaperRuntime namespace

From `Twig\Tests` to `Twig\Tests\Runtime`

Commits
-------

df4e66f4 Fix EscaperRuntime namespace
2024-07-30 09:30:10 +02:00
Simon André df4e66f420 Fix EscaperRuntime namespace
From `Twig\Tests` to `Twig\Tests\Runtime`
2024-07-30 00:36:02 +02:00
Fabien Potencier 215f9880f1 Remove the templateClassPrefix property on Environment 2024-07-28 16:25:21 +02:00
Fabien Potencier ae04075ed1 minor #4163 Use RawFilter in cache extra (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Use RawFilter in cache extra

Commits
-------

8e72c84c Use RawFilter in cache extra
2024-07-28 11:16:28 +02:00
Fabien Potencier 8e72c84c63 Use RawFilter in cache extra 2024-07-28 11:12:39 +02:00
Fabien Potencier 76becd4246 minor #4162 Simplify usage of RawFilter (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Simplify usage of RawFilter

Commits
-------

6e55b5f9 Simplify usage of RawFilter
2024-07-28 11:11:17 +02:00
Fabien Potencier 6e55b5f956 Simplify usage of RawFilter 2024-07-28 11:10:04 +02:00