Commit Graph

6740 Commits

Author SHA1 Message Date
Fabien Potencier d1beac4dfa Add compile-time checks for the "matches" operator 2024-09-21 10:29:51 +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
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
Fabien Potencier a2ed05aa87 minor #4316 Set IteratorAggregate generics for Node (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Set IteratorAggregate generics for Node

This will help PHPStan and Psalm to understand what happens when iterating over a Node.

/cc `@fabpot`

Commits
-------

ba6e856d92 Set IteratorAggregate generics for Node
2024-09-13 15:40:58 +02:00
Ruud Kamphuis ba6e856d92 Set IteratorAggregate generics for Node
This will help PHPStan and Psalm to understand what happens when iterating over a Node.
2024-09-13 15:04:20 +02:00
Fabien Potencier 048183eaa6 Add cross-link 2024-09-13 14:06:34 +02:00
Fabien Potencier 8d1af0fc03 Let's no deprecate the attribute function yet 2024-09-13 13:56:05 +02:00
Fabien Potencier 9ea43d8b60 minor #4312 Clarify docs for the u filter (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Clarify docs for the u filter

Closes #3299

Commits
-------

7961788224 Clarify docs for the u filter
2024-09-13 13:39:04 +02:00
Fabien Potencier ba5875b575 minor #4315 Add more precise types for the registration of safe classes (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Add more precise types for the registration of safe classes

Safe classes only impact the auto-escaping of the string casting of instance of those classes.
By defining that this method only expects names of stringable classes, it allows static analysis tools to report non-working configurations (for instance for people thinking this would impact the auto-escaping for values returned by getters of a safe class, as in https://github.com/twigphp/Twig/issues/4113 for instance).

The method technically support prefixing the class name with a `\`. Static analyzers would reject such string when checking for `class-string`. However, I think this is fine. Projects wanting to use a SA tool are probably already using the `::class` constant anyway to refer to class names (and otherwise, removing the leading `\` in their string literal is easy)

Commits
-------

8330936415 Add more precise types for the registration of safe classes
2024-09-13 13:08:24 +02:00
Christophe Coevoet 8330936415 Add more precise types for the registration of safe classes
Safe classes only impact the auto-escaping of the string casting of instance of those classes.
By defining that this method only expects names of stringable classes, it allows static analysis tools to report non-working configurations (for instance for people thinking this would impact the auto-escaping for values returned by getters of a safe class).
2024-09-13 12:58:50 +02:00
Fabien Potencier 1dfdd82cfe Clarify coding standards 2024-09-13 08:16:53 +02:00
Fabien Potencier c8bb3b1b69 Fix markup 2024-09-13 08:15:49 +02:00
Fabien Potencier b6e3ad895c Fix markup 2024-09-13 08:14:14 +02:00
Fabien Potencier 7961788224 Clarify docs for the u filter 2024-09-12 23:07:08 +02:00
Fabien Potencier 333638e8e6 Allow to use a dynamic attribute on the . operator via () 2024-09-12 21:44:45 +02:00
Fabien Potencier c6d6ef22ec minor #4309 Doc tweaks (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Doc tweaks

Commits
-------

08f28fd06c Remove most usage of foo/bar/baz in the docs
b1c35cd1fc Tweak docs
2024-09-12 21:42:19 +02:00
Fabien Potencier 08f28fd06c Remove most usage of foo/bar/baz in the docs 2024-09-12 21:40:08 +02:00
Fabien Potencier b1c35cd1fc Tweak docs 2024-09-12 19:19:56 +02:00
Javier Eguiluz b5d19ee4be [Doc] Provide an alternative for the deprecated spaceless filter 2024-09-12 11:42:41 +02:00
Fabien Potencier 6fa404ffdf minor #4306 Add StringCastUnary (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add StringCastUnary

Commits
-------

bfafa5b613 Add StringCastUnary
2024-09-12 07:44:29 +02:00
Fabien Potencier bfafa5b613 Add StringCastUnary 2024-09-11 22:23:33 +02:00
Fabien Potencier b2e66717a2 feature #4300 Add support for argument unpacking (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add support for argument unpacking

Closes #3291

Commits
-------

112de8dcfa Add support for argument unpacking
2024-09-11 16:14:43 +02:00
Fabien Potencier f2baecaa7c minor #4303 Fix typo (rylixs)
This PR was merged into the 3.x branch.

Discussion
----------

Fix typo

Commits
-------

c7d9a50727 Fix typo
2024-09-11 14:47:33 +02:00
Rylix c7d9a50727 Fix typo 2024-09-11 14:41:00 +02:00
Fabien Potencier 112de8dcfa Add support for argument unpacking 2024-09-11 11:55:09 +02:00
Fabien Potencier 1a20e96174 Fix CS 2024-09-11 10:45:54 +02:00
Fabien Potencier 053d6429d2 feature #4302 Add JSON support for the file extension escaping strategy (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add JSON support for the file extension escaping strategy

Closes #3657

Commits
-------

c616783674 Add JSON support for the file extension escaping strategy
2024-09-11 10:43:59 +02:00
Fabien Potencier c616783674 Add JSON support for the file extension escaping strategy 2024-09-11 10:01:22 +02:00
Fabien Potencier 8b421f58aa feature #4301 Stringify dynamic mapping keys (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Stringify dynamic mapping keys

Closes #3696

Commits
-------

ccfe6ad26e Stringify dynamic mapping keys
2024-09-11 09:51:54 +02:00
Fabien Potencier a7e924f36e minor #4298 Replace all empty() calls (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Replace all empty() calls

Commits
-------

9e9f8110bd Replace most empty() calls
2024-09-11 09:22:35 +02:00
Fabien Potencier 366e038359 minor #4299 Simplify parser calls when possible (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Simplify parser calls when possible

Commits
-------

3f07d2c034 Simplify parser calls when possible
2024-09-11 09:19:24 +02:00
Fabien Potencier ccfe6ad26e Stringify dynamic mapping keys 2024-09-11 08:58:53 +02:00
Fabien Potencier 9e9f8110bd Replace most empty() calls 2024-09-11 07:44:00 +02:00