Commit Graph

5431 Commits

Author SHA1 Message Date
Fabien Potencier 19c898bda3 Prepare the 2.14.12 release v2.14.12 2022-03-25 10:34:52 +01:00
Fabien Potencier 2d9da2d904 Update CHANGELOG 2022-03-25 10:34:21 +01:00
Fabien Potencier df053afb44 Fix docs 2022-03-25 09:53:24 +01:00
Fabien Potencier 3178098337 Tweak docs 2022-03-25 09:48:05 +01:00
Fabien Potencier c17b0af03e minor #3486 New info: Documents / filters / format_datetime: added info and examp… (EarthDweller)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

New info: Documents / filters / format_datetime: added info and examp…

…le of using argument `timezone`

issues 3477:
https://github.com/twigphp/Twig/issues/3477

Commits
-------

16d06cc4 New info: Documents / filters / format_datetime: added info and example of using argument `timezone`
2022-03-25 09:30:38 +01:00
Тимофей Соловейчик 16d06cc422 New info: Documents / filters / format_datetime: added info and example of using argument timezone 2022-03-25 09:30:27 +01:00
Fabien Potencier beea1a7c4a Add a test 2022-03-25 09:18:53 +01:00
Fabien Potencier d776736787 minor #3644 Added token type and value to error message (kmirzavaziri)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

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.

I think it helps a lot to have more expressive verbose error messages (specially in this case with the dot `.` operator, since it's the concatenation operator in PHP and developers may mistakenly use it instead of tilde `~` operator which is the concatenation operator in Twig.

I also think that it's better to extract the error message generating script out of `TokenStream::expect` (the code I included at the end of this message) and make it a new method with more general flexibility to be able to use the same method with all these scenarios but I'm not sure if this level of abstraction meets the Twig source policy so I didn't try to do that.

```
sprintf('%sUnexpected token "%s"%s ("%s" expected%s).',
                $message ? $message.'. ' : '',
                Token::typeToEnglish($token->getType()),
                $token->getValue() ? sprintf(' of value "%s"', $token->getValue()) : '',
                Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : '')
```

Commits
-------

6c8da65b Added token type and value to error message
2022-03-25 09:17:49 +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 65bedae131 minor #3667 Add phpdoc to SecurityPolicyInterface (VincentLanglet)
This PR was merged into the 2.x branch.

Discussion
----------

Add phpdoc to SecurityPolicyInterface

Hi @fabpot, this is a follow up of https://github.com/twigphp/Twig/pull/3664

I think adding phpdoc to this interface wouldn't hurt.
I took a look at https://github.com/twigphp/Twig/blob/2.x/src/Sandbox/SecurityPolicy.php to know the type of the parameters.

Commits
-------

e33f97cd Add phpdoc to SecurityPolicyInterface
2022-03-25 09:11:21 +01:00
Fabien Potencier 6f7bb4c983 bug #3671 Fix custom escapers when using multiple Twig environments (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Fix custom escapers when using multiple Twig environments

Closes #3668

Commits
-------

9c03ef0d Fix custom escapers when using multiple Twig environments
2022-03-25 09:03:17 +01:00
Fabien Potencier 9c03ef0d21 Fix custom escapers when using multiple Twig environments 2022-03-25 08:56:44 +01:00
Vincent Langlet e33f97cd8b Add phpdoc to SecurityPolicyInterface 2022-03-17 22:53:08 +01:00
Fabien Potencier 4c4fb89512 bug #3664 Rename variable in SecurityPolicyInterface.php (VincentLanglet)
This PR was merged into the 2.x branch.

Discussion
----------

Rename variable in SecurityPolicyInterface.php

Hi @fabpot

When using psalm, an error is reported when the name of the variable is not the same than the one in the interface.
This also could give issues with named params.

The securityPolicy implementation is using `property` as the name of the variable, which make a lot more sens https://github.com/twigphp/Twig/blob/3.x/src/Sandbox/SecurityPolicy.php#L110.

So I updated the interface. But I wasn't sure on which branch (1.x, 2.x, 3.x) I should have opened the PR.

I also wondering if you want me to rename $obj to $object maybe ?

Commits
-------

3f07c38c Rename variable
2022-03-15 09:46:17 +01:00
Vincent Langlet 3f07c38c9a Rename variable 2022-03-15 08:59:44 +01:00
Fabien Potencier 53c42377f5 bug #3654 do not reuse internally generated variable names during parsing (xabbuh)
This PR was merged into the 2.x branch.

Discussion
----------

do not reuse internally generated variable names during parsing

fixes #3647

Commits
-------

1411c454 do not reuse internally generated variable names during parsing
2022-02-25 09:29:50 +01:00
Christian Flothmann 1411c454c1 do not reuse internally generated variable names during parsing 2022-02-24 17:25:50 +01:00
Fabien Potencier 1e04274f34 Fix CHANGELOG 2022-02-04 08:03:05 +01:00
Fabien Potencier fca80b536d Bump version 2022-02-04 07:58:43 +01:00
Fabien Potencier 66baa66f29 Prepare the 2.14.11 release v2.14.11 2022-02-04 07:57:25 +01:00
Fabien Potencier 22b9dc3c03 bug #3641 Disallow non closures in sort filter when the sanbox mode is enabled (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Disallow non closures in `sort` filter when the sanbox mode is enabled

Commits
-------

2eb33080 Disallow non closures in `sort` filter when the sanbox mode is enabled
2022-02-04 07:54:44 +01:00
Fabien Potencier 2eb3308055 Disallow non closures in sort filter when the sanbox mode is enabled 2022-02-04 07:52:21 +01:00
Fabien Potencier e056e6385f bug #3638 Fix call to deprecated "convertToHtml" method (jderusse)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

Fix call to deprecated "convertToHtml" method

note: We can not rely on the new interface `ConverterInterface` because this interface already existed in [version 1.0](https://github.com/thephpleague/commonmark/blob/1.0/src/ConverterInterface.php)

Commits
-------

779fdd09 Fix call to deprecated "convertToHtml" method
2022-01-29 16:33:47 +01:00
Jérémy Derussé 779fdd09b4 Fix call to deprecated "convertToHtml" method 2022-01-29 16:33:44 +01:00
Fabien Potencier bbc33772da minor #3629 Fix map example output (alexander-schranz)
This PR was merged into the 2.x branch.

Discussion
----------

Fix map example output

@fabpot sorry little error in my #3628 pull request 🙈

Commits
-------

97411730 Fix map example output
2022-01-14 12:58:22 +01:00
Alexander Schranz 97411730ab Fix map example output 2022-01-14 12:53:45 +01:00
Fabien Potencier 9984a6ee55 minor #3628 Rename variables used in map method (alexander-schranz)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

Rename variables used in map method

As most people (including me) are lazy people to read text and mostly looks just at the code. Using `key` and `value` as variable make the map faster to understand which argument is which one :)

Commits
-------

b74cf2ae Rename variables used in map method
2022-01-14 12:47:31 +01:00
Alexander Schranz b74cf2ae6c Rename variables used in map method 2022-01-14 12:47:28 +01:00
Fabien Potencier e8068a9a6d bug #3626 The deprecated null value for the method round has been changed to zero. (v.arsentev)
This PR was submitted for the 3.x branch but it was squashed and merged into the 2.x branch instead.

Discussion
----------

The deprecated null value for the method round has been changed to zero.

Commits
-------

7d0e5d6a The deprecated null value for the method round has been changed to zero.
2022-01-11 16:12:47 +01:00
v.arsentev 7d0e5d6a1e The deprecated null value for the method round has been changed to zero. 2022-01-11 16:12:44 +01:00
Fabien Potencier 4c225d504f Bump version 2022-01-03 22:14:18 +01:00
Fabien Potencier 95fb194cd4 Prepare the 2.14.10 release v2.14.10 2022-01-03 22:13:26 +01:00
Fabien Potencier 7f04784e82 Update CHANGELOG 2022-01-03 22:12:46 +01:00
Fabien Potencier 9aa38454d5 bug #3619 Allow null for nl2br (ruudk)
This PR was merged into the 2.x branch.

Discussion
----------

Allow null for `nl2br`

Same as https://github.com/twigphp/Twig/pull/3617
Fixes `Passing null to parameter #1 ($string) of type string is deprecated` on PHP 8.1

Commits
-------

e9cd55de Allow null for nl2br, striptags and format filters
2022-01-03 17:03:24 +01:00
Ruud Kamphuis e9cd55def5 Allow null for nl2br, striptags and format filters
Same as https://github.com/twigphp/Twig/pull/3617
2022-01-03 14:28:28 +01:00
Fabien Potencier e155d8dcfc Bump version 2022-01-03 12:00:21 +01:00
Fabien Potencier d28b8d7390 Prepare the 2.14.9 release v2.14.9 2022-01-03 11:46:18 +01:00
Fabien Potencier c64d4855b9 Update CHANGELOG 2022-01-03 11:44:33 +01:00
Fabien Potencier f64f826751 Update CHANGELOG 2022-01-03 11:39:54 +01:00
Fabien Potencier 87ebcb0abb feature #3618 Re-add compat with PHP 7.1 (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Re-add compat with PHP 7.1

Closes #3613

Commits
-------

7389f48a Add compat with PHP 7.1 back
2022-01-03 11:39:12 +01:00
Fabien Potencier 7389f48a1f Add compat with PHP 7.1 back 2022-01-03 11:35:05 +01:00
Fabien Potencier 5ff043214f bug #3617 Allow null when Twig expects a string (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Allow null when Twig expects a string

To ease the transition to PHP 8.1, Twig now explicitly accepts `null` in addition to strings in filters that expect strings.

Closes #3615
Closes #3557
Closes #3610
Closes #3609

Commits
-------

92bc110b Allow null when Twig expects a string
2022-01-02 17:21:19 +01:00
Fabien Potencier 0ffdb3b94d minor #3616 Add 8.1 in tests (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Add 8.1 in tests

Commits
-------

3deeb0b2 Add 8.1 in tests
2022-01-02 16:31:31 +01:00
Fabien Potencier 3deeb0b2c0 Add 8.1 in tests 2022-01-02 16:26:34 +01:00
Fabien Potencier 92bc110bcf Allow null when Twig expects a string 2022-01-02 16:05:53 +01:00
Fabien Potencier ce97157b43 Bump license year 2022-01-02 11:02:19 +01:00
Fabien Potencier 8b989ebc8a bug #3608 Allow symfony/translation-contracts:^3 (michaljusiega)
This PR was merged into the 2.x branch.

Discussion
----------

Allow symfony/translation-contracts:^3

However,
I am just wondering why this dependency is required since it's not used anywhere in `twig/string-extra`? Or I am wrong ?

Closing https://github.com/twigphp/Twig/issues/3607

Commits
-------

0c1e4edc allow translation-contracts:^3
2021-12-26 18:56:12 +01:00
Fabien Potencier fa678e9244 minor #3611 Typo fix : "flexiblity" ➤ "flexibility" (Levure)
This PR was merged into the 2.x branch.

Discussion
----------

Typo fix : "flexiblity" ➤ "flexibility"

Commits
-------

ca1e79fc Typo fix : "flexiblity" ➤ "flexibility"
2021-12-26 18:49:51 +01:00
Bruno Baguette ca1e79fcec Typo fix : "flexiblity" ➤ "flexibility" 2021-12-26 18:41:09 +01:00
Michał Jusięga 0c1e4edc8b allow translation-contracts:^3 2021-12-22 17:41:26 +01:00