Commit Graph

7202 Commits

Author SHA1 Message Date
Fabien Potencier ea0ed28111 Merge branch '3.x' into 4.x
* 3.x:
  Add support for named arguments on macro calls and dot operator arguments
  Improve deprecation messages
  Simplify expression parser code
  Refactor expression parser
  chore: fix version added
  Cleanup code
2024-10-11 11:46:56 +02:00
Fabien Potencier 3eda65e94f feature #4391 Add support for named arguments on macro calls and dot operator arguments (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add support for named arguments on macro calls and dot operator arguments

Closes #929
Closes #3635

Commits
-------

223d36bbae Add support for named arguments on macro calls and dot operator arguments
2024-10-11 11:40:44 +02:00
Fabien Potencier 223d36bbae Add support for named arguments on macro calls and dot operator arguments 2024-10-11 11:31:40 +02:00
Fabien Potencier 10a4c82149 minor #4392 Improve deprecation messages (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Improve deprecation messages

Refs [in string should](https://github.com/twigphp/Twig/pull/4344#issuecomment-2406110007)
cc `@smnandre`

Commits
-------

ed1b44470f Improve deprecation messages
2024-10-11 08:38:34 +02:00
Fabien Potencier ed1b44470f Improve deprecation messages 2024-10-11 08:16:49 +02:00
Fabien Potencier 4a762bda4f minor #4386 Simplify expression parser code (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Simplify expression parser code

Commits
-------

0ec3f4a7fe Simplify expression parser code
2024-10-09 10:57:18 +02:00
Fabien Potencier 0ec3f4a7fe Simplify expression parser code 2024-10-09 10:33:51 +02:00
Fabien Potencier 086c07f319 minor #4385 Refactor expression parser (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Refactor expression parser

Instead of having if statements under `default`, I've moved the code to the `switch` statement, which makes more sense.

Commits
-------

2cdca8cbeb Refactor expression parser
2024-10-09 10:18:59 +02:00
Fabien Potencier 2cdca8cbeb Refactor expression parser 2024-10-09 09:14:02 +02:00
Fabien Potencier c25103752b minor #4384 chore: fix version added (94noni)
This PR was merged into the 3.x branch.

Discussion
----------

chore: fix version added

comming from slack message of `@javiereguiluz`
nice addition!

Commits
-------

309d3f50cb chore: fix version added
2024-10-09 07:44:35 +02:00
Antoine M 309d3f50cb chore: fix version added
comming from slack message of @javiereguiluz 
nice addition!
2024-10-08 22:19:25 +02:00
Fabien Potencier 7bf0f6f376 Cleanup code 2024-10-08 21:51:29 +02:00
Fabien Potencier dce4ba85b0 Remove obsolete code 2024-10-08 18:45:35 +02:00
Fabien Potencier 025278f576 Merge branch '3.x' into 4.x
* 3.x:
  Introduce a way to test Twig callables at compile time
  Allow arrow functions everywhere
  Fix deprecation dep feature
2024-10-08 18:44:24 +02:00
Fabien Potencier 818a07b591 feature #4304 Add a new guard tag that allows to test if some Twig callables are available at compilation time (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a new guard tag that allows to test if some Twig callables are available at compilation time

Closes #3655

~~`@javiereguiluz` Would that help?~~

~~Usage:~~

~~```php~~
~~$twig->registerFunctionStub('csrf_token', fn (string $tokenId) => '');~~
~~$twig->registerFunctionStub('importmap', fn (string|array $entryPoint = 'app', array $attributes = []): string => '');~~
~~$twig->registerTestStub('random', fn (string $value) => false);~~
~~```~~

See the docs on the new `guard` tag in the diff.

Commits
-------

62f0a96b68 Introduce a way to test Twig callables at compile time
2024-10-08 18:41:39 +02:00
Fabien Potencier 62f0a96b68 Introduce a way to test Twig callables at compile time 2024-10-08 18:41:34 +02:00
Fabien Potencier 9b3528904e feature #4378 Allow arrow functions everywhere (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Allow arrow functions everywhere

Closes #3192
Closes #3402

Arrow functions are now supported for all Twig callables (filters, functions, and tests), macro arguments, and method call arguments.

Arrow functions can also be stored in variables.

Commits
-------

aca4d22e89 Allow arrow functions everywhere
2024-10-08 09:29:37 +02:00
Fabien Potencier aca4d22e89 Allow arrow functions everywhere 2024-10-07 23:04:29 +02:00
Fabien Potencier b6eb2adb91 bug #4382 Fix deprecation dep feature (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix deprecation dep feature

Commits
-------

4f7d487a17 Fix deprecation dep feature
2024-10-07 23:02:40 +02:00
Fabien Potencier 4f7d487a17 Fix deprecation dep feature 2024-10-06 23:17:05 +02:00
Fabien Potencier 0dbc80db38 minor #4381 Fix getting nodes with int names (fabpot)
This PR was merged into the 4.x branch.

Discussion
----------

Fix getting nodes with int names

Commits
-------

14b5de7e54 Fix getting nodes with int names
2024-10-05 10:03:55 +02:00
Fabien Potencier d1bc1cb461 minor #4380 Remove remaining usages of get_class() (fabpot)
This PR was merged into the 4.x branch.

Discussion
----------

Remove remaining usages of get_class()

Commits
-------

cf603b19c1 Remove remaining usages of get_class()
2024-10-05 10:03:12 +02:00
Fabien Potencier 14b5de7e54 Fix getting nodes with int names 2024-10-05 09:38:51 +02:00
Fabien Potencier cf603b19c1 Remove remaining usages of get_class() 2024-10-05 09:33:37 +02:00
Fabien Potencier e98b10a802 Remove obsolete code 2024-10-04 21:08:34 +02:00
Fabien Potencier 43de153213 Merge branch '3.x' into 4.x
* 3.x:
  Move sandbox docs to its own chapter in the docs
  Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure)
  Fix markup
  Update html_cva.rst
  Fix markup
  Fix markup
  Added informations in format_currency and format_number docs
  Clarify docs for some operators
2024-10-04 21:05:35 +02:00
Fabien Potencier 5ac03a440c minor #4376 Move sandbox docs to its own chapter in the docs (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Move sandbox docs to its own chapter in the docs

I've also added more information about potential security issues when exposing something that takes a callable as an argument.

Commits
-------

6688a8df16 Move sandbox docs to its own chapter in the docs
2024-10-04 21:01:30 +02:00
Fabien Potencier 6688a8df16 Move sandbox docs to its own chapter in the docs 2024-10-04 21:00:19 +02:00
Fabien Potencier 1876635d23 feature #4377 Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure) (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure)

Instead of restricting callable arguments only in sandbox mode, let's deprecate using functions/arrays as callables.

Commits
-------

5e9448310d Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure)
2024-10-04 20:59:44 +02:00
Fabien Potencier 5e9448310d Deprecate passing a string or an array to Twig callable arguments accepting arrow functions (pass a Closure) 2024-10-04 18:51:37 +02:00
Fabien Potencier f363ab258b Fix markup 2024-10-04 08:05:19 +02:00
Fabien Potencier 62c0282d61 minor #4374 [Doc] html_cva (seb-jean)
This PR was merged into the 3.x branch.

Discussion
----------

[Doc] html_cva

Juste rename defaultVariant without "s".

Commits
-------

86b23eba23 Update html_cva.rst
2024-10-04 07:42:27 +02:00
seb-jean 86b23eba23 Update html_cva.rst 2024-10-04 07:32:20 +02:00
Fabien Potencier 53441af5ff Fix markup 2024-10-03 14:23:13 +02:00
Fabien Potencier c4d4141187 Fix markup 2024-10-03 14:09:21 +02:00
Fabien Potencier fc49d2f153 minor #3985 Added informations in format_currency and format_number docs (FlorianChenot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Added informations in format_currency and format_number docs

Commits
-------

e08ca837df Added informations in format_currency and format_number docs
2024-10-03 14:01:13 +02:00
unknown e08ca837df Added informations in format_currency and format_number docs 2024-10-03 14:00:37 +02:00
Fabien Potencier 69c2202081 minor #4372 Clarify docs for some operators (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Clarify docs for some operators

Closes #3922

Commits
-------

0d73fd232a Clarify docs for some operators
2024-10-02 16:18:34 +02:00
Fabien Potencier 0d73fd232a Clarify docs for some operators 2024-10-02 15:48:38 +02:00
Fabien Potencier dc657da5a6 Fix docs about operator precedence 2024-10-02 14:58:00 +02:00
Fabien Potencier 0d7a3cc49e Remove obsolete code 2024-10-02 14:22:18 +02:00
Fabien Potencier 14216a8d68 Merge branch '3.x' into 4.x
* 3.x:
  Deprecate using the not unary operator without parenthesis
  Deprecate using ?? without explicit parentheses
  Add support for logical `xor` operator
  Allow running CI on all branches
  [Doc] Fix enum title
  Document Twig vs PHP types
2024-10-02 14:19:28 +02:00
Fabien Potencier 247658c730 feature #4367 Trigger deprecations when using "??" and "not" without explicit parentheses when precedence will change in 4.0 (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Trigger deprecations when using "??" and "not" without explicit parentheses when precedence will change in 4.0

Closes #3387
Closes #3642

Commits
-------

2081b1ff74 Deprecate using the not unary operator without parenthesis
f4aacafd78 Deprecate using ?? without explicit parentheses
2024-10-02 14:17:10 +02:00
Fabien Potencier 2081b1ff74 Deprecate using the not unary operator without parenthesis 2024-10-02 14:16:34 +02:00
Fabien Potencier 915dea1f7c feature #4369 Add support for logical xor operator (HypeMC)
This PR was merged into the 3.x branch.

Discussion
----------

Add support for logical `xor` operator

Adds support for the logical `xor` operator

Commits
-------

8893944e0c Add support for logical `xor` operator
2024-10-02 10:02:50 +02:00
Fabien Potencier f4aacafd78 Deprecate using ?? without explicit parentheses 2024-10-01 21:58:05 +02:00
HypeMC 8893944e0c Add support for logical xor operator 2024-10-01 20:43:59 +02:00
Fabien Potencier 7d74d28e2e minor #4371 Allow running CI on all branches (HypeMC)
This PR was merged into the 3.x branch.

Discussion
----------

Allow running CI on all branches

This allows contributors to verify if the CI passes on their forks before opening a PR.

Commits
-------

6276d143c3 Allow running CI on all branches
2024-10-01 20:37:57 +02:00
HypeMC 6276d143c3 Allow running CI on all branches 2024-10-01 19:57:51 +02:00
Fabien Potencier a16053b4bf minor #4362 Document Twig vs PHP types (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Document Twig vs PHP types

Refs #4256

Commits
-------

9690e7bbbf Document Twig vs PHP types
2024-09-30 23:29:55 +02:00