Commit Graph

7042 Commits

Author SHA1 Message Date
Fabien Potencier efd12ef0cc Optimize NameExpression compilation 2025-01-02 12:32:36 +01:00
Fabien Potencier 15ef38c661 minor #4521 Fix typo in enum twig doc functions (BaptisteChabrol)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix typo in enum twig doc functions

Commits
-------

3889bc7b18 Fix typo in enum twig doc functions
2025-01-02 09:42:21 +01:00
Baptiste 3889bc7b18 Fix typo in enum twig doc functions 2025-01-02 09:42:18 +01:00
Fabien Potencier 708b8d0421 minor #4524 Remove "dead method" in ModuleNode (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

Remove "dead method" in ModuleNode

This method is not used after 1.x (it was used [in the compileConstructor](https://github.com/twigphp/Twig/blob/b1f009c449e435a0384814e67205d9190a4d050e/src/Node/ModuleNode.php#L206)) and has no caller anymore [in 2.x ](https://github.com/twigphp/Twig/blob/19185947ec75d433a3ac650af32fc05649b95ee1/src/Node/ModuleNode.php#L174)

ModuleNode is [marked final](https://github.com/twigphp/Twig/blob/d184e9fe12e1a8d219a95638ee78ad577a59e299/src/Node/ModuleNode.php#L31) in 3.x so I guess we can remove it safely.

Commits
-------

81ebebb210 Remove dead method in ModuleNode
2025-01-02 09:39:29 +01:00
Simon André 81ebebb210 Remove dead method in ModuleNode
This method is not used after 1.x (it was used in the compileConstructor)https://github.com/twigphp/Twig/blob/b1f009c449e435a0384814e67205d9190a4d050e/src/Node/ModuleNode.php#L206 and has no caller since 2.x https://github.com/twigphp/Twig/blob/19185947ec75d433a3ac650af32fc05649b95ee1/src/Node/ModuleNode.php#L174

ModuleNode is marked final so I guess we can remove it safely.
2025-01-02 07:17:52 +01:00
Fabien Potencier d184e9fe12 Bump version 2024-12-29 11:52:41 +01:00
Fabien Potencier acffa88cc2 Prepare the 3.18.0 release v3.18.0 2024-12-29 11:51:50 +01:00
Fabien Potencier 77d36abcb7 bug #4467 Add support for Twig\Markup (nlemoine)
This PR was merged into the 3.x branch.

Discussion
----------

Add support for `Twig\Markup`

Commits
-------

8158dabc17 Add support for `Twig\Markup`
2024-12-29 11:36:27 +01:00
Nicolas Lemoine 8158dabc17 Add support for Twig\Markup
Co-authored-by: Fabien Potencier <fabien@potencier.org>
2024-12-29 11:29:59 +01:00
Fabien Potencier 38688f739d minor #4506 Add a test (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a test

Commits
-------

2a6c986e85 Add a test
2024-12-29 11:23:06 +01:00
Fabien Potencier 2e13a83fe7 bug #4519 Fix unary operator precedence change (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix unary operator precedence change

Closes #4503

Commits
-------

2cf1939d01 Fix unary operator precedence change
2024-12-28 15:08:00 +01:00
Fabien Potencier 2cf1939d01 Fix unary operator precedence change 2024-12-28 11:29:38 +01:00
Fabien Potencier c7be388939 minor #4517 Replace Twigfiddle by the new Twig playground (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Replace Twigfiddle by the new Twig playground

https://symfony.com/blog/introducing-the-new-twig-playground

Commits
-------

4b87103468 Replace Twigfiddle by the new Twig playground
2024-12-26 14:59:15 +01:00
Fabien Potencier 4b87103468 Replace Twigfiddle by the new Twig playground 2024-12-26 14:58:29 +01:00
Fabien Potencier 681af9ddc1 bug #4516 Fix MacroNode $name argument can be overridden (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

Fix MacroNode $name argument can be overridden

Fix #4515

Commits
-------

dc329fd44e Fix MacroNode $name argument can be overridden
2024-12-26 11:03:16 +01:00
Simon André dc329fd44e Fix MacroNode $name argument can be overridden
Fix #4515
2024-12-26 10:28:13 +01:00
Fabien Potencier c1f7277b7b bug #4511 Ignore exceptions from undefined handlers when using the guard tag (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Ignore exceptions from undefined handlers when using the guard tag

Fixes #4505

Commits
-------

b53c639f7d Ignore exceptions from undefined handlers when using the guard tag
2024-12-20 07:51:39 +01:00
Fabien Potencier b53c639f7d Ignore exceptions from undefined handlers when using the guard tag 2024-12-19 15:10:50 +01:00
Fabien Potencier 91e609663e minor #4510 [Doc] Update the docs about attribute() function (javiereguiluz)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

[Doc] Update the docs about attribute() function

I Was fixing `filter` -> `function` error, but I realized that we could expand the docs of `attribute()` a bit, even if it's deprecated 🙏

Commits
-------

84daad9a27 [Doc] Update the docs about attribute() function
2024-12-19 08:40:12 +01:00
Javier Eguiluz 84daad9a27 [Doc] Update the docs about attribute() function 2024-12-19 08:39:55 +01:00
Fabien Potencier f99eab8541 feature #4504 Add a way to stream template rendering (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a way to stream template rendering

Even if we're using `yield` internally, there is no easy way to stream template rendering. This new method can be used like this to HTTP stream a template with Symfony:

```php
use Symfony\Component\HttpFoundation\StreamedResponse;
use Twig\Environment;

$twig = new Environment(/* ... */);

$response = new StreamedResponse($twig->load('index')->stream([]));
$response->send();
```

Commits
-------

1915ee2812 Add a way to stream template rendering
2024-12-18 19:14:01 +01:00
Fabien Potencier d78cb00f89 Fix doc 2024-12-18 12:19:13 +01:00
Fabien Potencier c13ca48ca5 Use .html.twig in code example instead of .html 2024-12-18 11:13:19 +01:00
Fabien Potencier 834a5a1e5a minor #4507 Use .html.twig file extension in documentation instead of .html (Pepperoni1337)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Use .html.twig file extension in documentation instead of .html

Use .html.twig file extensions instead of .html

Commits
-------

03792f643f Use .html.twig file extension in documentation instead of .html
2024-12-18 11:01:29 +01:00
Pepperoni1337 03792f643f Use .html.twig file extension in documentation instead of .html 2024-12-18 11:01:27 +01:00
Fabien Potencier 2a6c986e85 Add a test 2024-12-18 07:46:55 +01:00
Fabien Potencier 1915ee2812 Add a way to stream template rendering 2024-12-18 07:29:32 +01:00
Fabien Potencier c72b50434d Bump version 2024-12-18 07:29:21 +01:00
Fabien Potencier 918f52e818 feature #4501 adds support for invoking closures (faizanakram99)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

adds support for invoking closures

- fixes #3848

Commits
-------

0a61801d9a adds support for invoking closures
2024-12-14 20:06:36 +01:00
Faizan Akram 0a61801d9a adds support for invoking closures 2024-12-14 20:06:34 +01:00
Fabien Potencier dc2949e88e minor #4502 Change = to : for named arguments (seb-jean)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Change `=` to `:` for named arguments

Hi,
I changed `=` to `:` because it better follows best practices for named arguments.

Commits
-------

99ea35e1e8 Change `=` to `:` for named arguments
2024-12-14 19:49:02 +01:00
seb-jean 99ea35e1e8 Change = to : for named arguments 2024-12-14 19:49:00 +01:00
Fabien Potencier fa8544ca4c Update CHANGELOG 2024-12-12 15:18:17 +01:00
Fabien Potencier 77376c9302 Bump version 2024-12-12 10:59:04 +01:00
Fabien Potencier 677ef8da64 Prepare the 3.17.1 release v3.17.1 2024-12-12 10:58:10 +01:00
Fabien Potencier 243f5f5d53 bug #4500 Fix the null coalescing operator when the test returns null (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix the null coalescing operator when the test returns null

Closes #4499

Commits
-------

4c5467f56a Fix the null coalescing operator when the test returns null
2024-12-12 10:27:04 +01:00
Fabien Potencier 4c5467f56a Fix the null coalescing operator when the test returns null 2024-12-12 10:17:22 +01:00
Fabien Potencier 47f527ef84 bug #4498 Fix the Elvis operator when there is some space between ? and : (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix the Elvis operator when there is some space between ? and :

Commits
-------

1af334be89 Fix the Elvis operator when there is some space between ? and :
2024-12-11 11:04:38 +01:00
Fabien Potencier 1af334be89 Fix the Elvis operator when there is some space between ? and : 2024-12-11 10:38:21 +01:00
Fabien Potencier 31f61bd781 Bump version 2024-12-10 16:20:20 +01:00
Fabien Potencier d3a64b742a Prepare the 3.17.0 release v3.17.0 2024-12-10 16:19:11 +01:00
Fabien Potencier e24078cd0e Update CHANGELOG 2024-12-10 16:18:27 +01:00
Fabien Potencier d8a798c2cf bug #4496 Fix ArrayAccess with objects as keys (gharlan)
This PR was merged into the 3.x branch.

Discussion
----------

Fix ArrayAccess with objects as keys

fixes #4476
The bug was introduced in 3.15 via https://github.com/twigphp/Twig/pull/4425#discussion_r1869120001

Commits
-------

32a75b7869 Fix ArrayAccess with objects as keys
2024-12-10 15:38:55 +01:00
Gregor Harlan 32a75b7869 Fix ArrayAccess with objects as keys 2024-12-05 12:31:45 +01:00
Fabien Potencier 57bf519af2 minor #4492 fix version numbers for deprecations (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

fix version numbers for deprecations

#4482 was merged after the release of 3.16.0

Commits
-------

f90105d0ac fix version numbers for deprecations
2024-12-02 10:21:10 +01:00
Christian Flothmann f90105d0ac fix version numbers for deprecations 2024-12-02 10:21:03 +01:00
Fabien Potencier e1a5aa175e minor #4493 Require "erusev/parsedown": "dev-master as 1.x-dev" (nicolas-grekas)
This PR was merged into the 3.x branch.

Discussion
----------

Require "erusev/parsedown": "dev-master as 1.x-dev"

Should fix the CI until https://github.com/erusev/parsedown/pull/891 is merged.

Commits
-------

5287da57cc Require "erusev/parsedown": "dev-master as 1.x-dev"
2024-12-02 10:19:22 +01:00
Nicolas Grekas 5287da57cc Require "erusev/parsedown": "dev-master as 1.x-dev" 2024-12-02 09:57:02 +01:00
Fabien Potencier d894f92d12 feature #4487 Support underscores in number literals (smnandre)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Support underscores in number literals

```twig
{{ 1000 == 1_000 ? 'yes' : 'no' }}
# now: syntax error
# this PR: "yes"
```

> As of PHP 7.4.0, integer literals may contain underscores (_) between digits, for better readability of literals. These underscores are removed by PHP's scanner.

https://www.php.net/manual/en/language.types.integer.php

This PR replicates that behaviour, using the regexp to match the literals and then remove the "_".

I'm targeting **Twig4** but maybe 3.x would be ok?

I cannot think of a real case that
- does not trigger an error currently
- would work differently after this PR

Commits
-------

da4d96692a Support underscores in number literals
2024-12-02 09:47:00 +01:00
Simon André da4d96692a Support underscores in number literals 2024-12-02 09:46:54 +01:00