Fabien Potencier
e2f0128774
Merge branch '3.x' into 4.x
...
* 3.x:
Deprecate the fact that the `extends` and `use` tags are always allowed in a sandboxed template
Clarify block function
2024-08-28 13:56:42 +02:00
Fabien Potencier
5fca700cbd
Deprecate the fact that the extends and use tags are always allowed in a sandboxed template
2024-08-28 13:40:53 +02:00
Fabien Potencier
7c2f55b3d2
Merge branch '3.x' into 4.x
...
* 3.x:
Mark implicit macro argument default values as such with an attribute in AST
2024-08-27 13:22:48 +02:00
Fabien Potencier
f9f7b7959f
feature #4010 Mark implicit macro argument default values as such with an attribute in AST (drjayvee)
...
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Mark implicit macro argument default values as such with an attribute in AST
This change causes no difference to compiled templates or to macro argument semantics.
Consider the following macro:
```twig
{% macro marco(po, lo = null) %}{% endmacro %}
```
With this change, the `ConstantExpression` for argument `po` will have an attribute `is_implicit`, whose value will be `true`. (Note that `lo` will not have that attribute.)
This allows node visitors to distinguish between arguments that do and those that do not have explicit default values even if the value is `null`.
This is useful for [static code analysis](https://github.com/twigphp/Twig/issues/4003 ).
For example, a static analysis tool might consider arguments with no explicit default value as non-optional.
Commits
-------
e83a8028 Mark implicit macro argument default values as such with an attribute in AST
2024-08-27 13:21:41 +02:00
Jeroen Versteeg
e83a8028f0
Mark implicit macro argument default values as such with an attribute in AST
2024-08-27 13:21:06 +02:00
Fabien Potencier
76ed01d48a
Merge branch '3.x' into 4.x
...
* 3.x:
Fix CS
Fix two-word tests precedence over one-word tests
2024-08-27 13:19:46 +02:00
Fabien Potencier
58d5780ef3
Fix two-word tests precedence over one-word tests
2024-08-26 17:47:41 +02:00
Simon André
72bbe489e1
Add private types on 4.x
2024-08-21 20:05:41 +02:00
Fabien Potencier
2acd9e8d9f
Remove obsolete code
2024-08-21 08:21:08 +02:00
Fabien Potencier
65048fa3bb
Fix CS
2024-08-18 19:27:14 +02:00
Fabien Potencier
15c0adb3ed
Merge branch '3.x' into 4.x
...
* 3.x:
Fix CS
2024-08-18 19:26:04 +02:00
Fabien Potencier
675cb2d141
Fix CS
2024-08-18 19:25:19 +02:00
Fabien Potencier
d9f52db503
Merge branch '3.x' into 4.x
...
* 3.x:
Fix typos in CHANGELOG
2024-08-18 17:54:12 +02:00
Fabien Potencier
84116e5ff7
Fix typos in CHANGELOG
2024-08-18 17:52:16 +02:00
Fabien Potencier
aab6d74ce1
Move loop function implementation to CoreExtension
2024-08-17 23:08:38 +02:00
Fabien Potencier
93206a7d4a
Merge branch '3.x' into 4.x
...
* 3.x:
Add an extension point for parsing special functions
2024-08-17 23:06:33 +02:00
Fabien Potencier
4428079003
Add an extension point for parsing special functions
2024-08-17 18:06:14 +02:00
Fabien Potencier
fb06196948
Update loop function parsing
2024-08-17 18:04:49 +02:00
Fabien Potencier
22ff3f4f22
Merge branch '3.x' into 4.x
...
* 3.x:
Fix typos in CHANGELOG
Fix typo
Fix some minor issues
Add support for named arguments on special functions
2024-08-17 18:03:35 +02:00
Fabien Potencier
2e43eaa4ad
Fix some minor issues
2024-08-16 22:51:19 +02:00
Fabien Potencier
0c30e78b1c
Add support for named arguments on special functions
2024-08-16 08:37:24 +02:00
Fabien Potencier
62cc16f548
Merge branch '3.x' into 4.x
...
* 3.x:
Remove remaining const optimizations
2024-08-15 20:26:12 +02:00
Simon André
c662e0ce27
Remove remaining const optimizations
...
After #4198 some `Token::` const optimization remains.
This PR remove them.. **in case** it was not intended
2024-08-15 19:11:55 +02:00
Fabien Potencier
eaf04e53f0
Remove deprecated code
2024-08-14 23:34:13 +02:00
Fabien Potencier
abee6fc583
Merge branch '3.x' into 4.x
...
* 3.x:
Move FunctionExpression/FilterExpression/TestExpression attributes from compilation time to parsing time
Cleanup the implementation of the defined test for constants
2024-08-14 23:07:43 +02:00
Fabien Potencier
3156d8093e
Move FunctionExpression/FilterExpression/TestExpression attributes from compilation time to parsing time
2024-08-14 18:45:35 +02:00
Fabien Potencier
d7df8844e0
Merge branch '3.x' into 4.x
...
* 3.x:
Add missing method in TwigCallableInterface
Fix TwigCallableInterface
Simplify code
Make various optimization for dynamic Twig callables
2024-08-13 18:37:32 +02:00
Fabien Potencier
148d3e079d
Make various optimization for dynamic Twig callables
2024-08-12 09:45:32 +02:00
Fabien Potencier
c3791fe986
Merge branch '3.x' into 4.x
...
* 3.x:
Remove const optimization
2024-08-12 09:43:20 +02:00
Fabien Potencier
cd0ac3cc0a
Remove const optimization
2024-08-12 09:40:52 +02:00
Fabien Potencier
eafbee52e3
Merge branch '3.x' into 4.x
...
* 3.x:
Use trigger_deprecation() instead of trigger_error() for deprecations
Tweak docs
clarify that macros shadow other macros/functions
2024-08-08 14:47:26 +02:00
Fabien Potencier
0ce79df5c4
Use trigger_deprecation() instead of trigger_error() for deprecations
2024-08-08 14:28:28 +02:00
Fabien Potencier
a5882760df
Fix CS
2024-08-07 19:37:53 +02:00
Fabien Potencier
1a83f2c95b
Use RawFilter
2024-07-28 11:19:22 +02:00
Fabien Potencier
fa1a217f1a
Add another test
2024-07-28 10:08:38 +02:00
Fabien Potencier
c28f68f807
Add support for Escaper and Sandbox for Generator nodes
2024-07-28 10:08:38 +02:00
Fabien Potencier
c1933323ba
Simplify implementation
2024-07-28 10:08:38 +02:00
Fabien Potencier
8c5dd39b9b
Use loop() to recurse instead of loop.recurse()
2024-07-28 10:08:38 +02:00
Fabien Potencier
c77354ebad
Add missing comment
2024-06-22 19:44:04 +02:00
Fabien Potencier
8dda0153c4
Remove deprecated features
2024-06-22 19:43:36 +02:00
Fabien Potencier
3236429dc8
Merge branch '3.x' into 4.x
...
* 3.x:
Fix typo
Tweak
Rename array to sequence
Rename hash to mapping
2024-06-22 19:42:47 +02:00
Fabien Potencier
c44be99a84
Rename array to sequence
2024-06-22 19:37:51 +02:00
Fabien Potencier
5157402a77
Rename hash to mapping
2024-06-22 19:36:24 +02:00
Fabien Potencier
c250afdda0
Optimize sprintf() calls for PHP 8.4
2024-06-21 08:27:51 +02:00
Fabien Potencier
b63bde3063
Optimize sprintf() calls for PHP 8.4
2024-06-21 08:16:55 +02:00
Fabien Potencier
f9871531b7
Merge branch '3.x' into 4.x
...
* 3.x:
Fxi some errors reported by phpstan
2024-02-05 19:00:15 +01:00
Fabien Potencier
2b2ac80d34
Fxi some errors reported by phpstan
2024-02-05 17:48:36 +01:00
Fabien Potencier
af8ec178b6
Remove list() usage in code
2024-01-05 12:46:24 +01:00
Fabien Potencier
35640b6d2d
Add type hints to private properties
2023-12-14 20:43:37 +01:00
Fabien Potencier
308aa5ba45
Remove usage of list()
2023-12-09 15:33:38 +01:00