Commit Graph

7126 Commits

Author SHA1 Message Date
Fabien Potencier 3cdf26fe76 feature #3737 Added configuration for commonmark use in twig-extra-bundle. (doekenorg)
This PR was merged into the 3.x branch.

Discussion
----------

Added configuration for commonmark use in twig-extra-bundle.

Following this tweet: https://twitter.com/ramsey/status/1561894460560138241, this PR adds the configuration options for `commonmark` to the `twig-extra-bundle`.

The configuration is added to the `LeagueCommonMarkConverterFactory` and in turn injected in the `CommonMarkConverter`. This way a user can provide the configuration for usage inside twig.

I'm not sure if adding the configuration inside the extension is the way to go.

Hope this helps out at least `@ramsey` :-)

Added `ignoreExtraKeys` to be somewhat future proof in case extra configuration is added later on, and also to be able to provide de configuration for extensions.

Commits
-------

6f20629622 Added configuration for commonmark use in twig-extra-bundle.
2025-02-08 10:44:24 +01:00
Fabien Potencier fab1a37d8e bug #4546 Fix timezone conversion on strings (PrinsFrank)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix timezone conversion on strings

When setting a default application timezone, and a display timezone:
```php
date_default_timezone_set('UTC');
$twig->getExtension(\Twig\Extension\CoreExtension::class)->setTimezone('Europe/Paris');
```

Date objects get converted, but strings don't. See #4545.

For most other paths in `convertDate`, the dateTime object is initialized, and afterwards the timezone gets set. For strings, the timezone is passed as a constructor argument before having the timezone set again, losing its converting behaviour. This makes the convertDate method work identical for DateTime objects as strings. This different behaviour was already spotted in #3568.

Fixes #4545 #3568 #2819

Commits
-------

f69531fa00 Fix timezone conversion on strings
2025-02-07 22:52:13 +01:00
PrinsFrank f69531fa00 Fix timezone conversion on strings 2025-02-07 22:52:10 +01:00
Fabien Potencier 7f12e871af bug #4572 Use correct lineno for ForElseNode (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Use correct lineno for ForElseNode

It should take the line number of the `{% else %}` block.

Commits
-------

a84e602b4f Use correct lineno for ForElseNode
2025-02-07 15:19:42 +01:00
Ruud Kamphuis a84e602b4f Use correct lineno for ForElseNode
It should take the line number of the `{% else %}` block.
2025-02-07 14:48:08 +01:00
Fabien Potencier 8432946eee feature #4571 Add support for registered undefined element callbacks in tests (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Add support for registered undefined element callbacks in tests

This also defines the proper type for the callable arguments in those methods, allowing to know the expected signature (and allowing static analysis tools to check it) instead of having to inspect the implementation to see how those callables are used.

Commits
-------

198fc1a9f9 Add support for registered undefined element callbacks in tests
2025-02-04 12:35:15 +01:00
Christophe Coevoet 198fc1a9f9 Add support for registered undefined element callbacks in tests 2025-02-04 10:28:21 +01:00
Fabien Potencier 9157c1686c minor #4570 Add UnaryInterface (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add UnaryInterface

Commits
-------

9ccca47b8a Add UnaryInterface
2025-02-03 21:25:09 +01:00
Fabien Potencier 9ccca47b8a Add UnaryInterface 2025-02-03 21:23:35 +01:00
Fabien Potencier 462eedd43f minor #4569 Add BinaryInterface (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add BinaryInterface

`@stof` That's what you had in mind for https://github.com/twigphp/Twig/pull/4543#discussion_r1939732064?

Commits
-------

fa1ffb5b29 Add BinaryInterface
2025-02-03 21:16:08 +01:00
Fabien Potencier fa1ffb5b29 Add BinaryInterface 2025-02-03 19:21:18 +01:00
Fabien Potencier 2cc081da2c minor #4568 Reimplement the cache tag in an adhoc way (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Reimplement the cache tag in an adhoc way

Commits
-------

3288d8d98d Reimplement the cache tag in an adhoc way
2025-02-03 13:13:59 +01:00
Fabien Potencier 3288d8d98d Reimplement the cache tag in an adhoc way 2025-02-03 12:49:20 +01:00
Fabien Potencier af5f4c34fb Fix CS 2025-02-03 08:48:19 +01:00
Fabien Potencier 3f9974e688 bug #4567 Fix wrong array index (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix wrong array index

Commits
-------

7f080086dc Fix wrong array index
2025-02-01 16:24:04 +01:00
Fabien Potencier 7f080086dc Fix wrong array index 2025-02-01 16:22:20 +01:00
Fabien Potencier fff563810a bug #4565 Fix wrong array index (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix wrong array index

Fixes #4563

Commits
-------

b0399992be Fix wrong array index
2025-02-01 10:33:39 +01:00
Fabien Potencier b0399992be Fix wrong array index 2025-02-01 10:33:30 +01:00
Fabien Potencier a5ebdfe1f5 minor #4564 Add even more tests (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add even more tests

Commits
-------

e48abfe47c Add even more tests
2025-01-31 21:47:55 +01:00
Fabien Potencier 8438235572 feature #4566 Bump min PHP version to 8.1 (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Bump min PHP version to 8.1

Commits
-------

dc6356268b Bump min PHP version to 8.1
2025-01-31 21:46:09 +01:00
Fabien Potencier dc6356268b Bump min PHP version to 8.1 2025-01-31 21:45:36 +01:00
Fabien Potencier e48abfe47c Add even more tests 2025-01-31 19:03:58 +01:00
Fabien Potencier 4b4a630bdc minor #4562 Add some tests on balanced brackets (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add some tests on balanced brackets

Commits
-------

3b605c4180 Add some tests on balanced brackets
2025-01-30 21:19:22 +01:00
Fabien Potencier 3b605c4180 Add some tests on balanced brackets 2025-01-30 13:38:40 +01:00
Fabien Potencier 69f8d40448 Bump version 2025-01-29 08:07:20 +01:00
Fabien Potencier d4f8c2b863 Prepare the 3.19.0 release v3.19.0 2025-01-29 08:06:14 +01:00
Fabien Potencier 38576b12f0 security #cve-2025-24374 [SECURITY] Fix a security issue where escaping was missing when using ?? (fabpot)
This PR was merged into the 3.x branch.
2025-01-29 07:57:48 +01:00
Fabien Potencier 445f74cfe0 [SECURITY] Fix a security issue where escaping was missing when using ?? 2025-01-29 07:52:07 +01:00
Fabien Potencier b63863709c minor #4560 Fix typo for html_cva code example (matthieupetel)
This PR was merged into the 3.x branch.

Discussion
----------

Fix typo for html_cva code example

Fix a typo where 'red' should be 'blue' according to the code above.

Commits
-------

83da53c3f1 Fix typo for html_cva code example
2025-01-28 21:29:08 +01:00
Matthieu Pétel 83da53c3f1 Fix typo for html_cva code example
Fix a typo where 'red' should be 'blue' according to the above code.
2025-01-28 10:51:09 +01:00
Fabien Potencier 48d167a297 minor #4558 Fix CS (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix CS

Commits
-------

f594248a40 Fix CS
2025-01-26 11:54:38 +01:00
Fabien Potencier f594248a40 Fix CS 2025-01-26 11:54:00 +01:00
Fabien Potencier fcd0332dca minor #4557 Fix Token::__toString() (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix Token::__toString()

Broken by #4554

Commits
-------

11535e9058 Fix Token::__toString()
2025-01-25 16:41:44 +01:00
Fabien Potencier 11535e9058 Fix Token::__toString() 2025-01-25 16:41:07 +01:00
Fabien Potencier b680354bbb minor #4556 fix intl-extra tests (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

fix intl-extra tests

Commits
-------

18007078ba fix intl-extra tests
2025-01-24 21:37:36 +01:00
Fabien Potencier d76d2d7d26 minor #4555 add missing parentheses to deprecation message (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

add missing parentheses to deprecation message

Commits
-------

431697fc05 add missing parentheses to deprecation message
2025-01-24 21:36:20 +01:00
Christian Flothmann 18007078ba fix intl-extra tests 2025-01-24 21:20:33 +01:00
Christian Flothmann 431697fc05 add missing parentheses to deprecation message 2025-01-24 20:59:56 +01:00
Fabien Potencier 939c0324c7 feature #4554 Deprecate Token::getType() (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate Token::getType()

This change will allow us to deprecate some types and let us trigger a deprecation.

Commits
-------

ade8bce516 Deprecate Token::getType()
2025-01-24 15:50:48 +01:00
Fabien Potencier ade8bce516 Deprecate Token::getType() 2025-01-24 15:48:04 +01:00
Fabien Potencier c542debe58 feature #4553 Add ForElseNode (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add ForElseNode

Replaces #4473 for 3.x

Commits
-------

609767522a Add ForElseNode
2025-01-24 15:29:49 +01:00
Fabien Potencier 609767522a Add ForElseNode 2025-01-24 15:25:30 +01:00
Fabien Potencier 17b35c80fa feature #4552 Deprecate passing $ifexpr to ForNode (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate passing $ifexpr to ForNode

Commits
-------

9d16de6e3d Deprecate passing $ifexpr to ForNode
2025-01-24 15:07:44 +01:00
Fabien Potencier 9d16de6e3d Deprecate passing $ifexpr to ForNode 2025-01-24 15:01:34 +01:00
Fabien Potencier 93466404b7 feature #4550 Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments() (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments()

Commits
-------

960f6762ed Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments()
2025-01-24 14:36:45 +01:00
Fabien Potencier ce40c69bc7 feature #4551 Fix inheritance logic to be able to use instanceof ContextVariable instead of NameExpression (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix inheritance logic to be able to use instanceof ContextVariable instead of NameExpression

Commits
-------

b6d9dd62ee Fix inheritance logic to be able to use instanceof ContextVariable instead of NameExpression
2025-01-24 14:09:02 +01:00
Fabien Potencier b6d9dd62ee Fix inheritance logic to be able to use instanceof ContextVariable instead of NameExpression 2025-01-24 13:47:29 +01:00
Fabien Potencier 72c91f6260 minor #4534 Add return type annotations on Twig 3 to prepare Twig 4 (smnandre)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add return type annotations on Twig 3 to prepare Twig 4

Started to add missing type annotation following `@stof` comment [here](https://github.com/twigphp/Twig/pull/4523#discussion_r1901915880).

Update:  I checked here every class (but one) in the `src` directory.

But you should ~~probably~~ **certainely** have another look.

Remains:
- src/ExpressionParser.php, where i'm not confident enough about the best return types (AbstractExpression|null works almost everytime, but lack some precision)
- extra directory
- tests directory

I'm happy to let them to someone else.... this was less fun than I expected 😅

Commits
-------

82be13429c Add return type annotations on Twig 3 to prepare Twig 4
2025-01-24 11:33:02 +01:00
Simon André 82be13429c Add return type annotations on Twig 3 to prepare Twig 4 2025-01-24 11:32:59 +01:00
Fabien Potencier 960f6762ed Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments() 2025-01-23 08:35:56 +01:00