Commit Graph

6291 Commits

Author SHA1 Message Date
Fabien Potencier 117b502411 bug #4037 fix: #4033 add missing unwrap call on TemplateWrapper instance (TLG-Gildas)
This PR was merged into the 3.x branch.

Discussion
----------

fix: #4033 add missing unwrap call on TemplateWrapper instance

Commits
-------

6c631526 fix: #4033 add missing unwrap call when a TemplateWrapper instance can be present
2024-04-18 07:51:18 -04:00
Fabien Potencier 89d6acfe31 bug #4038 Ensure Lexer:: is always initialized (danut007ro)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Ensure Lexer:: is always initialized

I'm using Symfony Bridge `LintCommand` with `--show-deprecations` flag.

While Twig is initializing, if an deprecation error is thrown by `Lexer::getOperatorRegex()` method, the `Lexer::$regexes` will remain `null` but `$isInitialized` will be set to TRUE.

This PR ensures that `$regexes` will be initialized.

Commits
-------

5a79652e Ensure Lexer:: is always initialized
2024-04-18 07:49:48 -04:00
Daniel Gorgan 5a79652e7c Ensure Lexer:: is always initialized 2024-04-18 07:49:46 -04:00
Fabien Potencier 15f596635d bug #4036 change extended DI extension class (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

change extended DI extension class

Commits
-------

b61a4224 change extended DI extension class
2024-04-18 07:36:11 -04:00
Fabien Potencier be6dbbc102 bug #4035 fix: #4029 CaptureNode iterator_to_array preserveKeys false (TLG-Gildas)
This PR was merged into the 3.x branch.

Discussion
----------

fix: #4029 CaptureNode iterator_to_array preserveKeys false

Commits
-------

f7121a23 fix: #4029 when use_yield is true CaptureNode use iterator_to_array preserveKeys argument to false
2024-04-18 07:32:31 -04:00
Gildas de Cadoudal 6c6315263e fix: #4033 add missing unwrap call when a TemplateWrapper instance can be present 2024-04-18 11:47:39 +02:00
Christian Flothmann b61a422493 change extended DI extension class 2024-04-18 11:24:21 +02:00
Gildas de Cadoudal f7121a23bc fix: #4029 when use_yield is true CaptureNode use iterator_to_array preserveKeys argument to false 2024-04-18 09:45:09 +02:00
Fabien Potencier 7d2b814e6c bug #4032 Add twig_escape_filter_is_safe() as deprecated. (brummbar)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add twig_escape_filter_is_safe() as deprecated.

Fix for #4031

Commits
-------

1170144f Add twig_escape_filter_is_safe() as deprecated.
2024-04-17 15:26:51 -04:00
Francesco Sardara 1170144f66 Add twig_escape_filter_is_safe() as deprecated. 2024-04-17 15:26:49 -04:00
Fabien Potencier c145871023 Bump version 2024-04-17 10:17:23 -04:00
Fabien Potencier 856cb5a6cf Prepare the 3.9.2 release v3.9.2 2024-04-17 10:16:25 -04:00
Fabien Potencier 58ae42d940 bug #4028 Fix usage of display_end hook (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix usage of display_end hook

Commits
-------

3ca9685f Fix usage of display_end hook
2024-04-17 10:12:04 -04:00
Fabien Potencier 3ca9685f58 Fix usage of display_end hook 2024-04-17 08:50:57 -04:00
Fabien Potencier 2d169bdca2 bug #4027 Require correct twig core version (Benedikt-Brunner)
This PR was merged into the 3.x branch.

Discussion
----------

Require correct twig core version

This changes the composer version constraint of the internationalisation extension on the core twig library, to require atleast version 3.9.0. This is necessary since twig/intl-extra now depends on CoreExtension::dateConverter() which was only introduced with the release of version 3.9 (see: twigphp/Twig@54d34b9).

Commits
-------

5d903b63 Require correct twig core version
2024-04-17 08:45:04 -04:00
benedikt brunner 5d903b6325 Require correct twig core version 2024-04-17 12:41:53 +00:00
Fabien Potencier 0b4269e6c1 Bump version 2024-04-17 05:00:49 -04:00
Fabien Potencier 664647f46b Prepare the 3.9.1 release v3.9.1 2024-04-17 05:00:00 -04:00
Fabien Potencier 5bad94781a bug #4023 Fix CaptureNode for some use cases (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix CaptureNode for some use cases

Closes #4022

Commits
-------

64cebe0e Fix CaptureNode for some use cases
2024-04-17 04:58:19 -04:00
Fabien Potencier 64cebe0e0b Fix CaptureNode for some use cases 2024-04-17 04:57:55 -04:00
Fabien Potencier 2105d65957 Bump version 2024-04-16 12:05:55 -04:00
Fabien Potencier 47857eebb1 Prepare the 3.9.0 release v3.9.0 2024-04-16 12:04:21 -04:00
Fabien Potencier e58b2feda2 Update CHANGELOG 2024-04-16 12:04:02 -04:00
Fabien Potencier 8150b6819e feature #4011 Add PHP 8.4 support (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add PHP 8.4 support

Commits
-------

fdfc5ddd Fix compat with PHP 8.4
11511e18 Add PHP 8.4 to CI
2024-04-16 11:47:32 -04:00
Fabien Potencier fdfc5dddb6 Fix compat with PHP 8.4 2024-04-16 11:43:55 -04:00
Fabien Potencier 11511e181d Add PHP 8.4 to CI 2024-04-14 12:38:37 +02:00
Fabien Potencier 6091e7d60c Remove usage of array() in fixtures 2024-04-14 12:38:19 +02:00
Fabien Potencier 6f3d173f64 Fix markup 2024-04-14 12:32:42 +02:00
Fabien Potencier c8ec14cb6f feature #3943 Deprecate passing a Template instance in Environment::resolveTemplate() and Template::loadTemplate() (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Deprecate passing a Template instance in Environment::resolveTemplate() and Template::loadTemplate()

Commits
-------

dbe9456f Fix incompatibility with old PHP versions
a62581ae Fix typo
61031d6c Deprecate passing a Template instance in Environment::resolveTemplate() and Template::loadTemplate()
2024-04-14 11:16:15 +02:00
Fabien Potencier dbe9456f77 Fix incompatibility with old PHP versions 2024-04-14 11:16:06 +02:00
Fabien Potencier a62581ae5e Fix typo 2024-04-14 11:15:26 +02:00
Fabien Potencier 61031d6cfa Deprecate passing a Template instance in Environment::resolveTemplate() and Template::loadTemplate() 2024-04-14 11:15:25 +02:00
Fabien Potencier f6d620ce3d feature #4019 Add a deprecation notice when using AbstractNodeVisitor (deprecated since 2.9) (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a deprecation notice when using AbstractNodeVisitor (deprecated since 2.9)

Commits
-------

41d702d6 Add a deprecation notice when using AbstractNodeVisitor (deprecated since 2.9)
2024-04-14 11:09:12 +02:00
Fabien Potencier 41d702d6be Add a deprecation notice when using AbstractNodeVisitor (deprecated since 2.9) 2024-04-14 10:44:50 +02:00
Fabien Potencier fe2bdd2b66 Fix doc markup 2024-04-14 10:44:37 +02:00
Fabien Potencier 30b5658f89 Fix CS 2024-04-14 10:22:11 +02:00
Fabien Potencier 34f1bec64c minor #4018 Update coding_standards.rst: "one (and only one)" => "exactly one" (ThomasLandauer)
This PR was merged into the 3.x branch.

Discussion
----------

Update coding_standards.rst: "one (and only one)" => "exactly one"

Page: https://twig.symfony.com/doc/3.x/coding_standards.html

Commits
-------

97df38b3 Update coding_standards.rst: "one (and only one)" => "exactly one"
2024-04-13 19:17:21 +02:00
Thomas Landauer 97df38b39d Update coding_standards.rst: "one (and only one)" => "exactly one"
Page: https://twig.symfony.com/doc/3.x/coding_standards.html
2024-04-13 10:44:08 +02:00
Fabien Potencier 5191fbc1a3 minor #4017 Add a reference to the Twig CS fixer tool (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a reference to the Twig CS fixer tool

Commits
-------

b6ae45c3 Add a reference to the Twig CS fixer tool
2024-04-13 09:39:01 +02:00
Fabien Potencier b6ae45c3d9 Add a reference to the Twig CS fixer tool 2024-04-13 09:36:08 +02:00
Fabien Potencier 64ee590d46 bug #4014 Fix exception when timezone is false (Seb33300)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix exception when timezone is false

When passing `false` in the timezone param, twig returns an exception:

> An exception has been thrown during the rendering of a template ("Twig\Extra\Intl\IntlExtension::createDateFormatter(): Argument 5 ($timezone) must be of type ?DateTimeZone, bool given

Passing `false` is supported and allows to skip the timezone conversion.

Regression introduced by https://github.com/twigphp/Twig/pull/3903

Commits
-------

7e8f5eb1 Fix exception when timezone is false
2024-04-03 17:08:28 +02:00
Sébastien Alfaiate 7e8f5eb1a5 Fix exception when timezone is false 2024-04-03 17:08:24 +02:00
Fabien Potencier 870da7f0b1 minor #4016 Fix param name in docblock (minor) (smnandre)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix param name in docblock (minor)

Fix wrong var name in Docblock

[CoreExtension::striptags()](https://github.com/twigphp/Twig/commit/dd81f28507de5c45b99e91dafa5a9908c2686dde#diff-29e85e483c6ec4a9c2fd144820b6722c86df60d54175b355d85e806253313c1aL1221)
```diff
     * Strips HTML and PHP tags from a string.
     *
     * `@param` string|null          $string
-     * `@param` string[]|string|null $string
+     * `@param` string[]|string|null $allowable_tags
     *
     */
    public static function striptags($string, $allowable_tags = null)
    {
```

--

Also added some missing nullable in `@param` annotations, not sure if expected :|

Commits
-------

2d262bc3 Fix param name in docblock (minor)
2024-04-03 13:36:39 +02:00
Simon André 2d262bc35f Fix param name in docblock (minor) 2024-04-03 13:36:36 +02:00
Nicolas Grekas b46e93c725 Minor fixes 2024-02-15 12:09:06 +01:00
Fabien Potencier 0990f81500 feature #3999 Add #[YieldReady] to allow extensions to tell when they're ready for yielding (nicolas-grekas)
This PR was merged into the 3.x branch.

Discussion
----------

Add `#[YieldReady]` to allow extensions to tell when they're ready for yielding

The current opt-in based on "use_yield" doesn't work, because there is no decider to enable the flag:
the flag can be turned on only when all extensions are compatible, and this is fragile, because extensions currently don't have a way to signal that they are ready for yielding.

This PR takes the following approach instead:
- Between each "yield", the output buffer is checked and emptied.
- Extensions need to label their node implementations with `#[YieldReady]`. If they don't, a deprecation is raised.

On Twig 4, we could then just remove this output buffer check and possibly throw when a node is not "YieldReady".

(Classes that extend `AbstractExpression` are implicitly considered "YieldReady".)

Best reviewed [ignoring whitespaces](https://github.com/twigphp/Twig/pull/3999/files?w=1).

Commits
-------

e7077740 Add `#[YieldReady]` to allow extensions to tell when they're ready for yielding
2024-02-15 10:45:14 +01:00
Nicolas Grekas e70777405d Add #[YieldReady] to allow extensions to tell when they're ready for yielding 2024-02-15 10:27:26 +01:00
Fabien Potencier 7f5958c5e3 minor #3996 Remove redundant "instanceof \Countable" check (minor) (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

Remove redundant "instanceof \Countable" check (minor)

In [CoreExtension::lengthFilter](https://github.com/twigphp/Twig/compare/3.x...smnandre:fix/remove-check-countable?expand=1#diff-29e85e483c6ec4a9c2fd144820b6722c86df60d54175b355d85e806253313c1a), the check L1183 is redundant as "`$thing instanceof \Countable`" is already checked L1175.

```diff
    if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) {
        return \count($thing);
    }

    if ($thing instanceof \Traversable) {
        return iterator_count($thing);
    }

-    if (method_exists($thing, '__toString') && !$thing instanceof \Countable) {
+    if (method_exists($thing, '__toString')) {
        return mb_strlen((string) $thing, $env->getCharset());
    }
```

Commits
-------

2836af3d Remove redundant "$thing instanceof \Countable" check
2024-02-10 10:00:39 +01:00
Fabien Potencier 17bf9a0abd minor #3997 Fix CS (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix CS

Commits
-------

f7f11ea4 Fix CS
2024-02-10 10:00:21 +01:00
Fabien Potencier f7f11ea410 Fix CS 2024-02-10 09:52:03 +01:00