Commit Graph

6277 Commits

Author SHA1 Message Date
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
Fabien Potencier 5a25ea338a minor #3993 fix TwigExtraBundle tests with Symfony 6.0/6.1 (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

fix TwigExtraBundle tests with Symfony 6.0/6.1

Commits
-------

d9d7e136 fix TwigExtraBundle tests with Symfony 6.0/6.1
2024-02-10 09:50:56 +01:00
Simon André 2836af3d3f Remove redundant "$thing instanceof \Countable" check
The check L1183 is redundant as "$thing instanceof \Countable" is already checked L1175.

```php
        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) {
            return mb_strlen((string) $thing, $env->getCharset());
        }
```
2024-02-10 02:32:40 +01:00
Fabien Potencier 675f62d60c Update PHPUnit schema 2024-02-07 12:11:29 +01:00
Christian Flothmann d9d7e136c1 fix TwigExtraBundle tests with Symfony 6.0/6.1 2024-02-07 09:24:24 +01:00
Fabien Potencier 7e1945a618 minor #3991 Fix some errors reported by phpstan (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix some errors reported by phpstan

Commits
-------

2b2ac80d Fxi some errors reported by phpstan
2024-02-05 18:59:35 +01:00
Fabien Potencier 2b2ac80d34 Fxi some errors reported by phpstan 2024-02-05 17:48:36 +01:00
Fabien Potencier 84bb846172 Fix tests config 2024-02-05 16:10:51 +01:00
Fabien Potencier d3b5922620 Fix tests config 2024-02-05 16:08:29 +01:00
Fabien Potencier edf5808144 feature #3950 Deprecate usage of ob_* functions in favor of yielding (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Deprecate usage of ob_* functions in favor of yielding

Still a work in progress, but everything works fine in both modes.

Commits
-------

a93723ea Fix bug
0d3a2839 Tweak code
14d38036 Add a deprecation when a Node uses echo/print
210e2d2b Fix tests
1591aa5c Optimize code
1469e6a6 Add support for templates that do not have output Nodes
72922a36 -
71e90fab Remove some tests
4fd62abb -
a9c7307b Tweak code
15879406 Remove the new yield nodes
3b6cbf98 Remove usage of ob_* functions in favor of yielding
2024-02-05 14:24:44 +01:00
Fabien Potencier a93723eae2 Fix bug 2024-01-25 13:09:58 +01:00
Fabien Potencier 0d3a283907 Tweak code 2024-01-25 13:09:58 +01:00
Fabien Potencier 14d3803647 Add a deprecation when a Node uses echo/print 2024-01-25 13:09:58 +01:00
Fabien Potencier 210e2d2b9e Fix tests 2024-01-25 13:09:58 +01:00
Fabien Potencier 1591aa5c7d Optimize code 2024-01-25 13:09:58 +01:00