Commit Graph

6770 Commits

Author SHA1 Message Date
Fabien Potencier d008fa408e minor #4345 Add fixture filename as key (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Add fixture filename as key

This way, it's easier to see which test failed and what the file was.

In PHPStorm this is visualized very nice.
![Screenshot 2024-09-26 at 14 19 49@2x](https://github.com/user-attachments/assets/1fe87364-c014-4cff-9b90-b9db0368efc8)

Commits
-------

633d70103d Add fixture filename as key
2024-09-26 15:11:48 +02:00
Fabien Potencier fea6cc344e minor #4346 Remove useless assign in compiled code (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Remove useless assign in compiled code

It's already unset / initialized on catch.

Having it this way, is a bit easier for me when analyzing this in TwigStan.

Commits
-------

5c73c6695c Remove useless assign in compiled code
2024-09-26 15:10:13 +02:00
Fabien Potencier d1c754ecdf minor #4344 Improve escape deprecation message (ruudk)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Improve escape deprecation message

This was introduced in https://github.com/twigphp/Twig/pull/4176

According to #4343 the message can be improved.

I made a few changes to the test to make it easier to work with. Best to review this PR **commit by commit**.

/cc `@stof`

Commits
-------

7256713c86 Improve escape deprecation message
2024-09-26 15:09:44 +02:00
Ruud Kamphuis 7256713c86 Improve escape deprecation message 2024-09-26 15:09:41 +02:00
Ruud Kamphuis 5c73c6695c Remove useless assign in compiled code 2024-09-26 14:36:01 +02:00
Ruud Kamphuis 633d70103d Add fixture filename as key
This way, it's easier to see which test failed and what the file was.

In PHPStorm this is visualized very nice.
2024-09-26 14:19:35 +02:00
Fabien Potencier 4607cce80f minor #4342 Be more precise about double-escaping (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Be more precise about double-escaping

Closes #3918

Commits
-------

fe3d615aa4 Be more precise about double-escaping
2024-09-26 12:52:31 +02:00
Fabien Potencier fe3d615aa4 Be more precise about double-escaping 2024-09-26 08:58:21 +02:00
Fabien Potencier be308bc5ac feature #4341 Add start/end time accessors on Profile (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add start/end time accessors on Profile

Closes #3418

Commits
-------

f83c844b7d Add start/end time accessors on Profile
2024-09-26 08:23:09 +02:00
Fabien Potencier f83c844b7d Add start/end time accessors on Profile 2024-09-26 08:19:38 +02:00
Fabien Potencier bb30a7ba26 bug #4340 Fix 'ignore missing' when used on an 'embed' tag (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix 'ignore missing' when used on an 'embed' tag

Closes #3085

Commits
-------

09790a7542 Fix 'ignore missing' when used on an 'embed' tag
2024-09-26 07:56:31 +02:00
Fabien Potencier 09790a7542 Fix 'ignore missing' when used on an 'embed' tag 2024-09-26 07:55:44 +02:00
Fabien Potencier 588a5c5676 bug #4339 Fix the possibility to override an aliased block (via use) (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix the possibility to override an aliased block (via use)

Closes #3709

Commits
-------

955611d5bb Fix the possibility to override an aliased block (via use)
2024-09-25 22:17:13 +02:00
Fabien Potencier c203b27db2 feature #4334 Improve how trim behaves (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Improve how trim behaves

Closes #3651

Commits
-------

10c3142d3b Improve how trim behaves
2024-09-25 22:10:15 +02:00
Fabien Potencier 955611d5bb Fix the possibility to override an aliased block (via use) 2024-09-25 22:08:16 +02:00
Fabien Potencier 3ddab4f8b4 feature #4338 Add template cache hot reload (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add template cache hot reload

Closes #3880

This PR achieves 2 things in the minimum amount of code (in 2 commits):

* It adds a new `RemovableCacheInterface` that allows cache to be removed.
* It adds a memory cache to allow updating existing templates in the same process (think FrakenPHP for instance) without polluting the permanent cache.

Commits
-------

00ba8046b0 Add test
dca5099aad Add hot cache reload for templates
786a67b1a9 Add RemovableCacheInterface
2024-09-25 18:40:47 +02:00
Fabien Potencier 00ba8046b0 Add test 2024-09-25 17:28:51 +02:00
Fabien Potencier dca5099aad Add hot cache reload for templates 2024-09-25 17:28:51 +02:00
Fabien Potencier 786a67b1a9 Add RemovableCacheInterface 2024-09-25 17:28:51 +02:00
Fabien Potencier 04f21b2650 minor #4337 Add some tests (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add some tests

Closes #3691

The bug described in #3691 has been fixed via #3999.

This PR adds tests to prove it works now and to avoid future regressions.

Commits
-------

85c2ba5147 Add some tests
2024-09-25 10:43:15 +02:00
Fabien Potencier 85c2ba5147 Add some tests 2024-09-24 22:13:47 +02:00
Fabien Potencier efc527ea65 minor #4333 Optimize compiled code for "set" tag (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Optimize compiled code for "set" tag

Commits
-------

9855e35d44 Optimize compiled code for "set" tag
2024-09-24 17:04:08 +02:00
Fabien Potencier 9855e35d44 Optimize compiled code for "set" tag 2024-09-24 16:47:02 +02:00
Fabien Potencier 10c3142d3b Improve how trim behaves 2024-09-24 13:35:40 +02:00
Fabien Potencier 3930d90842 Add more tests 2024-09-24 13:28:51 +02:00
Fabien Potencier d3a0717ab0 minor #4330 Add compile-time checks for the "matches" operator (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add compile-time checks for the "matches" operator

Commits
-------

d1beac4dfa Add compile-time checks for the "matches" operator
2024-09-23 18:11:23 +02:00
Fabien Potencier 653735fe26 minor #4331 Add return types in FileystemLoader (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Add return types in FileystemLoader

Commits
-------

15279ca8ee Add return types in FileystemLoader
2024-09-23 18:10:44 +02:00
Ruud Kamphuis 15279ca8ee Add return types in FileystemLoader 2024-09-23 12:30:37 +02:00
Fabien Potencier d1beac4dfa Add compile-time checks for the "matches" operator 2024-09-21 10:29:51 +02:00
Fabien Potencier 49b699b25e minor #4328 Improve formatDate methods phpdoc (VincentLanglet)
This PR was merged into the 3.x branch.

Discussion
----------

Improve formatDate methods phpdoc

`convertDate`
- Supports null https://github.com/twigphp/Twig/blob/3.x/src/Extension/CoreExtension.php#L539
- Supports timestamp passed as integer https://github.com/twigphp/Twig/blob/3.x/src/Extension/CoreExtension.php#L549

So the phpdoc should not be
`\DateTimeInterface|string|null` but `\DateTimeInterface|string|int|null`

And all the date methods using `convertDate` should also accepts int and null.

This is important since some tools are developing static analysis on twig.

Commits
-------

3be417d2eb Improve date methods phpdoc
2024-09-21 09:13:04 +02:00
Fabien Potencier 3f03d2bc0a minor #4324 [Doc] Document about html and html_attr strategies (Kocal)
This PR was merged into the 3.x branch.

Discussion
----------

[Doc] Document about `html` and `html_attr` strategies

Ref #4322

Commits
-------

ac88c9ae75 [Doc] Document about `html` and `html_attr` strategies
2024-09-21 08:07:22 +02:00
Hugo Alliaume ac88c9ae75 [Doc] Document about html and html_attr strategies
Co-authored-by: Fabien Potencier <fabien@potencier.org>
2024-09-20 20:33:08 +02:00
Vincent Langlet 3be417d2eb Improve date methods phpdoc 2024-09-20 11:43:16 +02:00
Fabien Potencier 9e1b5449bf minor #4327 Fix deprecation messages (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix deprecation messages

Commits
-------

07b626a96f Fix deprecation messages
2024-09-19 23:14:29 +02:00
Fabien Potencier 07b626a96f Fix deprecation messages 2024-09-19 23:13:12 +02:00
Fabien Potencier 30aac6d2f2 bug #4323 Fix the handling of predefined arguments in CallExpression (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Fix the handling of predefined arguments in CallExpression

Commits
-------

37fa03681e fix the handling of predefined arguments in CallExpression
2024-09-19 23:11:28 +02:00
Fabien Potencier fddf885b1b minor #4325 Use a more precise return type in AbstractTwigCallable (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Use a more precise return type in AbstractTwigCallable

This method is not expected to change the type of callable.

As using it is the only way to configure arguments for a Twig callable (there is no constructor argument for them), it avoids getting static analysis errors in `Extension::getFunctions()` when using it.

Commits
-------

ebbbaf7069 Use a more precise return type in AbstractTwigCallable
2024-09-19 23:10:44 +02:00
Christophe Coevoet ebbbaf7069 Use a more precise return type in AbstractTwigCallable 2024-09-19 13:46:59 +02:00
Christophe Coevoet 37fa03681e fix the handling of predefined arguments in CallExpression 2024-09-19 11:48:28 +02:00
Fabien Potencier 70886ec75e feature #4318 Allow Twig callable arguments to use camel or snake names (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Allow Twig callable arguments to use camel or snake names

Closes #3475

Twig callables (functions/filters/tests) now accept snake and camel argument names independently of the name of the underlying PHP callable parameter names.

Commits
-------

52ded207d3 Allow Twig callable arguments to use camel or snake names
2024-09-18 19:19:26 +02:00
Fabien Potencier 52ded207d3 Allow Twig callable arguments to use camel or snake names 2024-09-18 19:19:20 +02:00
Fabien Potencier b8b0313db1 minor #4320 fix intl-extra tests (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

fix intl-extra tests

The Caribbean guilder was added in symfony/symfony#58183.

Commits
-------

c5486b07b9 fix intl-extra tests
2024-09-16 12:40:32 +02:00
Christian Flothmann c5486b07b9 fix intl-extra tests 2024-09-16 12:21:35 +02:00
Fabien Potencier c4ab91f6ea minor #4319 fix typo (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

fix typo

Commits
-------

0d1821b0d3 fix typo
2024-09-16 12:04:33 +02:00
Christian Flothmann 0d1821b0d3 fix typo 2024-09-16 12:03:13 +02:00
Fabien Potencier 03f695fe95 minor #4308 [Doc] Provide an alternative for the deprecated spaceless filter (javiereguiluz, fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

[Doc] Provide an alternative for the deprecated spaceless filter

When a feature is deprecated, it's recommended to provide an alternative for it (or mention that there's no alternative).

So, let's mention the whitespace control features in the deprecation message of the `spaceless` filter.

Commits
-------

5a94ddc76e Suggest wording
b5d19ee4be [Doc] Provide an alternative for the deprecated spaceless filter
2024-09-14 10:56:32 +02:00
Fabien Potencier 5a94ddc76e Suggest wording 2024-09-14 10:56:07 +02:00
Fabien Potencier 1b9df761b6 feature #4310 Allow to use a dynamic attribute on the . operator via () (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Allow to use a dynamic attribute on the . operator via ()

Closes #3598

As one can think that the `attribute` function has some special power compared to the `.` operator (like using Symfony PropertyAccess), I think it's better to use the `.` operator for dynamic attributes as well.

Using `()` makes it clear that the behavior is the same as the `.` operator (using `()` is similar to the way one can use dynamic mapping names (like in `{ (name): value }`).

Commits
-------

048183eaa6 Add cross-link
8d1af0fc03 Let's no deprecate the attribute function yet
333638e8e6 Allow to use a dynamic attribute on the . operator via ()
2024-09-14 10:41:58 +02:00
Fabien Potencier 4c9526a31d Rename a variable for more clarity 2024-09-14 10:31:13 +02:00
Fabien Potencier 45156aab11 minor #4314 Clarify coding standards (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Clarify coding standards

Refs #3545

Commits
-------

1dfdd82cfe Clarify coding standards
2024-09-14 10:29:17 +02:00