Fabien Potencier
1488238e32
Fix ignored parenthesis in expressions
2024-09-28 23:47:01 +02:00
Fabien Potencier
8b278986b8
Deprecate using Node directly, introduce EmptyNode and Nodes
2024-09-27 07:42:41 +02:00
Nicolas Grekas
04471ab8cd
Replace strtr() by strtolower()
2024-09-26 17:48:39 +02:00
Fabien Potencier
07b626a96f
Fix deprecation messages
2024-09-19 23:13:12 +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
112de8dcfa
Add support for argument unpacking
2024-09-11 11:55:09 +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
9e9f8110bd
Replace most empty() calls
2024-09-11 07:44:00 +02:00
Fabien Potencier
3f07d2c034
Simplify parser calls when possible
2024-09-10 23:42:58 +02:00
Fabien Potencier
34ae0311d9
Improve the way one can deprecate a Twig callable
2024-09-09 21:14:40 +02:00
Fabien Potencier
2ae0c0d38c
Fix CS
2024-09-06 12:33:38 +02:00
Fabien Potencier
70b912fa10
minor #4228 Use CPP in full code base (andreybolonin)
...
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Use CPP in full code base
Commits
-------
28923f42 Use CPP in full code base
2024-08-29 19:29:42 +02:00
andreybolonin1989@gmail.com
28923f4269
Use CPP in full code base
2024-08-29 19:29:39 +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
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
58d5780ef3
Fix two-word tests precedence over one-word tests
2024-08-26 17:47:41 +02:00
Fabien Potencier
675cb2d141
Fix CS
2024-08-18 19:25:19 +02:00
Fabien Potencier
84116e5ff7
Fix typos in CHANGELOG
2024-08-18 17:52:16 +02:00
Fabien Potencier
4428079003
Add an extension point for parsing special functions
2024-08-17 18:06:14 +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
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
3156d8093e
Move FunctionExpression/FilterExpression/TestExpression attributes from compilation time to parsing time
2024-08-14 18:45:35 +02:00
Fabien Potencier
148d3e079d
Make various optimization for dynamic Twig callables
2024-08-12 09:45:32 +02:00
Fabien Potencier
cd0ac3cc0a
Remove const optimization
2024-08-12 09:40:52 +02:00
Fabien Potencier
0ce79df5c4
Use trigger_deprecation() instead of trigger_error() for deprecations
2024-08-08 14:28:28 +02:00
Fabien Potencier
c77354ebad
Add missing comment
2024-06-22 19:44:04 +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
b63bde3063
Optimize sprintf() calls for PHP 8.4
2024-06-21 08:16:55 +02: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
Jérôme Tamarelle
fb0d7495a8
Compile Elvis operator with Elvis operator
2023-10-21 19:08:38 +02:00
Jérôme Tamarelle
6d715e2002
Remove unused variables and unreachable code
2023-10-08 21:18:06 +02:00
Ryan Weaver
ba4fe3ba34
Adding support for the ...spread operator on arrays and hashes
2023-07-20 16:08:57 +02:00
Fabien Potencier
d769ae90d1
feature #3670 Add "some" and "every" filters (Jean-Beru)
...
This PR was merged into the 3.x branch.
Discussion
----------
Add "some" and "every" filters
This PR adds 2 new tests inspired from Javascript's functions: [some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some ) and [every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every ).
Usage :
```twig
Value {{ ([1, 2, 3] has some v => v == 2) ? 'found' : 'not found' }}
Key {{ ([1, 2, 3] has some (v, k) => k == 2) ? 'found' : 'not found' }}
Every values {{ ([1, 2, 3] has every v => 42 > v) ? 'match' : 'do not match' }}
Every keys {{ ([1, 2, 3] has every (v, k) => 42 > k) ? 'match' : 'do not match' }}
```
Commits
-------
009bb4fd Add "some" and "every" filters
2022-12-26 17:18:29 +01:00
Vincent Langlet
e98a652a6c
Improve phpdoc of ExtensionInterface/Environment/Expressionparser arrays
2022-11-18 10:55:01 +01:00
Vincent Langlet
de0f947efc
Remove internal from ExpressionParser
2022-10-20 22:22:52 +02:00
hubert.lenoir
009bb4fd82
Add "some" and "every" filters
2022-03-25 11:04:50 +01:00
Fabien Potencier
3fef888756
Merge branch '2.x' into 3.x
...
* 2.x:
Add a test
Added token type and value to error message
Add phpdoc to SecurityPolicyInterface
2022-03-25 09:18:59 +01:00
Kamyar Mirzavaziri
6c8da65b74
Added token type and value to error message
...
Added the given token type and value to the error message in case that the token after '.' is neither a name nor a number.
2022-03-25 09:17:46 +01:00
Fabien Potencier
9e6e700f96
minor #3509 Some code style fixes (dionisvl)
...
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Some code style fixes
Fixes that:
- Type cast is unnecessary
- Unnecessary curly braces syntax for variable
- Operations priority might differ that except
Commits
-------
17c6371f Some code style fixes
2021-05-14 10:26:10 +02:00
Den
17c6371fb5
Some code style fixes
2021-05-14 10:26:05 +02:00
Fabien Potencier
13e360972a
Merge branch '2.x' into 3.x
...
* 2.x:
Fix CS
Fix CS
Migrate to the new PHP CS Fixer config file
Fixing links
2021-05-12 09:45:40 +02:00
Fabien Potencier
2dd1d909b9
Fix CS
2021-05-12 09:37:17 +02:00
Fabien Potencier
7759111e75
Merge branch '2.x' into 3.x
...
* 2.x:
Update CHANGELOG
Update CHANGELOG
Fix previous merge
Make round brackets optional for one argument tests like sameas
2020-08-23 14:22:39 +02:00
Fabien Potencier
9bf49d5ccf
Merge branch '1.x' into 2.x
...
* 1.x:
Update CHANGELOG
Fix previous merge
Make round brackets optional for one argument tests like sameas
2020-08-23 14:22:09 +02:00
Andreas
1ee72d9e15
Make round brackets optional for one argument tests like sameas
2020-08-23 14:16:31 +02:00
Fabien Potencier
f9ae0f8237
Merge branch '2.x' into 3.x
...
* 2.x:
Bump version
Bump version
Tweak docs
Update CHANGELOG
Support object init from variable
2020-08-23 14:02:58 +02:00