Commit Graph

6904 Commits

Author SHA1 Message Date
Fabien Potencier 32e99c263d Remove obsolete code 2024-11-06 21:45:08 +01:00
Fabien Potencier cf5d4e3bc8 Update CHANGELOG 2024-11-06 21:41:52 +01:00
Nicolas Grekas b957e5a44c Sandbox ArrayAccess and do sandbox checks before isset() checks 2024-11-06 21:41:25 +01:00
Fabien Potencier d4a302681b Fix sandbox handling for __toString() 2024-11-06 21:35:53 +01:00
Fabien Potencier 98e7f7141a minor #4432 Fix mistake in docs for keys filter (ruudk)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix mistake in docs for `keys` filter

Commits
-------

deb37c30c4 Fix mistake in docs for `keys` filter
2024-11-04 08:50:22 +01:00
Ruud Kamphuis deb37c30c4 Fix mistake in docs for keys filter 2024-11-04 08:50:19 +01:00
Fabien Potencier b99d73c927 Update CHANGELOG 2024-11-03 15:09:58 +01:00
Fabien Potencier 8d3bad4c50 feature #4426 [String] Add SpanishInflector support for singular and plural (dennistobar)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

[String] Add SpanishInflector support for singular and plural

This PR implement a new Inflector using Spanish (ISO Code = es) implemented in this PR symfony/symfony#58228.

* I sort the list of supported Inflectors to follow some rule (alphabet?)
* I just change invalid test from "it" to "qq" (qq doesn't exist as valid ISO code, but it is italian... don't be evil if anyone want to create the italian inflector 😅 )

Commits
-------

290a923a42 [String] Add SpanishInflector support for singular and plural
2024-11-03 15:08:50 +01:00
Dennis Tobar 290a923a42 [String] Add SpanishInflector support for singular and plural 2024-11-03 15:08:48 +01:00
Fabien Potencier e062a17cc5 minor #4430 Add find to Filters docs (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Add `find` to `Filters` docs

https://twig.symfony.com/doc/3.x/filters/index.html
https://twig.symfony.com/doc/3.x/filters/find.html

It's missing or I am blind.

Commits
-------

b4ed19b5e1 Add `find` to `Filters` docs
2024-11-03 15:07:52 +01:00
Ruud Kamphuis b4ed19b5e1 Add find to Filters docs
https://twig.symfony.com/doc/3.x/filters/index.html
https://twig.symfony.com/doc/3.x/filters/find.html
2024-10-31 15:57:00 +01:00
Fabien Potencier 75751250cc minor #4423 Remove duplicate test case (jdreesen)
This PR was merged into the 3.x branch.

Discussion
----------

Remove duplicate test case

The test cases in line `7` and `9` were the same.

Commits
-------

d59cc8baa5 Remove duplicate test case
2024-10-30 08:17:12 -04:00
Jacob Dreesen d59cc8baa5 Remove duplicate test case 2024-10-28 11:25:54 +01:00
Fabien Potencier 494f010d29 Revert "minor #4411 Add return type to getDebugInfo (ruudk)"
This reverts commit 868b429853, reversing
changes made to b0017ad8c3.
2024-10-25 16:01:04 +02:00
Fabien Potencier 09b4693fdb minor #4420 Add $this return type to Template::unwrap (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Add `$this` return type to Template::unwrap

See https://phpstan.org/writing-php-code/phpdoc-types#static-and-%24this

This way, PHPStan understands that the returned template is the exact same instance, and not just a Template.

Commits
-------

92e4989002 Add `$this` return type to Template::unwrap
2024-10-25 15:58:24 +02:00
Ruud Kamphuis 92e4989002 Add $this return type to Template::unwrap
See https://phpstan.org/writing-php-code/phpdoc-types#static-and-%24this

This way, PHPStan understands that the returned template is the exact same instance, and not just a Template.
2024-10-25 13:19:27 +02:00
Fabien Potencier 55d56c4cb9 minor #4412 Add link to TwigQI in docs "You might also be interested in" section (drjayvee)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add link to TwigQI in docs "You might also be interested in" section

As proposed by Fabien last Thursday at Evolve. Merci beaucoup!

Commits
-------

4a0568521a Add link to TwigQI in docs "You might also be interested in" section
2024-10-25 11:36:55 +02:00
Jeroen Versteeg 4a0568521a Add link to TwigQI in docs "You might also be interested in" section 2024-10-25 11:36:55 +02:00
Fabien Potencier 05550cafb1 minor #4410 Add return type to compiled macro (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Add return type to compiled macro

This makes it easier for TwigStan to analyze the return type.

Commits
-------

1e7c719e24 Add return type to compiled macro
2024-10-25 08:22:06 +02:00
Fabien Potencier 89fdc7d31d Refactor code 2024-10-25 07:47:55 +02:00
Fabien Potencier f3db1d1a0c bug #4413 do not drop none digit characters from generated variable names (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

do not drop none digit characters from generated variable names

I was wondering if it was really intended to cast the var name generated by the compiler to an int as done in #4398. Doesn't this create the risk of variable names being reused at some point?

Commits
-------

5b0209ffa3 do not drop none digit characters from generated variable names
2024-10-24 17:55:22 +02:00
Christian Flothmann 5b0209ffa3 do not drop none digit characters from generated variable names 2024-10-24 17:52:15 +02:00
Fabien Potencier 1d22d300fa Revert "feature #4409 Deprecate the range function (fabpot)"
This reverts commit 99c6fbd517, reversing
changes made to 868b429853.
2024-10-24 15:37:54 +02:00
Fabien Potencier 99c6fbd517 feature #4409 Deprecate the range function (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate the range function

Commits
-------

3d99e595c8 Deprecate the range function
2024-10-24 15:34:03 +02:00
Fabien Potencier 3d99e595c8 Deprecate the range function 2024-10-24 14:02:46 +02:00
Ruud Kamphuis 1e7c719e24 Add return type to compiled macro
This makes it easier for TwigStan to analyze the return type.
2024-10-24 13:51:09 +02:00
Fabien Potencier 868b429853 minor #4411 Add return type to getDebugInfo (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Add return type to getDebugInfo

Commits
-------

0bb49dc40f Add return type to getDebugInfo
2024-10-24 13:49:49 +02:00
Ruud Kamphuis 0bb49dc40f Add return type to getDebugInfo 2024-10-24 13:37:17 +02:00
Fabien Potencier b0017ad8c3 feature #4408 Improve ImportNode impl (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Improve ImportNode impl

Commits
-------

612c7a14be Improve ImportNode impl
2024-10-24 07:27:50 +02:00
Fabien Potencier 612c7a14be Improve ImportNode impl 2024-10-24 07:23:37 +02:00
Fabien Potencier 2735f81a22 feature #4398 Rename Node classes related to variables (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Rename Node classes related to variables

Whenever I work on Twig internals, it's always complicated to reason about variable names, probably because the class names are confusing. This PR is an attempt to find "better" and more explicit names.

This PR does the following renaming:

 * `NameExpression` to `Variable\ContextVariable`
    Represents the value of a context variable like `$context[VAR] ?? null`

 * `AssignNameExpression` to `Variable\AssignContextVariable`
    Represents a context variable assignment like in `$context[VAR] = `

 * `TempNameExpression` to `Variable\LocalVariable`
    Represents a "private" local variable like `$_l111`

Commits
-------

fc15e7ccbc Rename Node classes related to variables
2024-10-23 22:29:28 +02:00
Fabien Potencier f43eba5b10 minor #4403 Documentation for types tag uses Twig types in examples instead of PHP (drjayvee)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Documentation for types tag uses Twig types in examples instead of PHP

Specifically, "bool" => "boolean" and "int" => "number".

This aligns the `types` documentation with templates.rst. See #4362

Thanks, `@alexander`-schranz!

Commits
-------

f3e0a00cf0 Documentation for types tag uses Twig types in examples instead of PHP
2024-10-23 16:54:05 +02:00
Jeroen Versteeg f3e0a00cf0 Documentation for types tag uses Twig types in examples instead of PHP 2024-10-23 16:54:04 +02:00
Fabien Potencier fc15e7ccbc Rename Node classes related to variables 2024-10-23 12:36:57 +02:00
Fabien Potencier af4090757b feature #4402 Rework macros handling (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Rework macros handling

Commits
-------

f1481be00f Remove MacroAutoImportNodeVisitor
72693884c4 Simplify code
1105964873 Rework macros handling
2024-10-22 11:03:01 +02:00
Fabien Potencier f1481be00f Remove MacroAutoImportNodeVisitor 2024-10-21 12:09:30 +02:00
Fabien Potencier 72693884c4 Simplify code 2024-10-21 07:20:17 +02:00
Fabien Potencier 1105964873 Rework macros handling 2024-10-20 21:53:20 +02:00
Fabien Potencier bcceaa3468 minor #4401 reduce the deprecation noise when more than one argument is passed (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

reduce the deprecation noise when more than one argument is passed

When more than one argument is passed to parseArguments(), one deprecation is triggered for each argument. Since passing any argument is deprecated the number of triggered deprecations can be reduced for more than one argument being passed.

Commits
-------

26256fc488 reduce the deprecation noise when more than one argument is passed
2024-10-20 21:48:23 +02:00
Fabien Potencier bde4efac5a Remove default value for an argument 2024-10-20 11:39:45 +02:00
Christian Flothmann 26256fc488 reduce the deprecation noise when more than one argument is passed
When more than one argument is passed to parseArguments(), one deprecation
is triggered for each argument. Since passing any argument is deprecated
the number of triggered deprecations can be reduced for more than one
argument being passed.
2024-10-18 11:24:56 +02:00
Fabien Potencier 448efb89bb bug #4397 Check reserved names in TempNameExpression (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Check reserved names in TempNameExpression

Commits
-------

66658a3c1d Check reserved names in TempNameExpression
2024-10-15 21:24:13 +02:00
Fabien Potencier 66658a3c1d Check reserved names in TempNameExpression 2024-10-14 19:42:47 +02:00
Fabien Potencier 950ad5a2fc bug #4396 Fix AssignNameExpression to forbid using names that won't work (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix AssignNameExpression to forbid using names that won't work

Commits
-------

9af72e6323 Fix AssignNameExpression to forbid using names that won't work
2024-10-14 14:07:02 +02:00
Fabien Potencier 9af72e6323 Fix AssignNameExpression to forbid using names that won't work 2024-10-14 13:55:40 +02:00
Fabien Potencier d45057536e bug #4395 Do not allow : as macro definition separator (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Do not allow : as macro definition separator

Commits
-------

831e69b77e Do not allow : as macro definition separator
2024-10-14 11:44:10 +02:00
Fabien Potencier 831e69b77e Do not allow : as macro definition separator 2024-10-14 10:42:32 +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