Commit Graph

6906 Commits

Author SHA1 Message Date
Fabien Potencier cc1045e4e4 Merge branch '3.x' into 4.x
* 3.x:
  Replace `return; yield` with `yield from []`
  Fix testExtensionsAreNotInitializedWhenRenderingACompiledTemplate
  Fix MacroTest
2024-09-03 13:55:51 +02:00
Fabien Potencier f0c337690f minor #4259 Replace return; yield with yield from [] (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Replace `return; yield` with `yield from []`

This has the same effect, but looks less hacky and makes PHPStan happy.
https://phpstan.org/r/df7fcc88-1df8-428e-b675-5dc6965c34d6

Previously this was needed to work properly with output capturing.

/cc `@fabpot` `@nicolas`-grekas

https://3v4l.org/KXste

Commits
-------

09a43a9f Replace `return; yield` with `yield from []`
2024-09-03 13:17:04 +02:00
Ruud Kamphuis 09a43a9f6f Replace return; yield with yield from []
This has the same effect, but looks less hacky and makes PHPStan happy.
https://phpstan.org/r/df7fcc88-1df8-428e-b675-5dc6965c34d6

Previously this was needed to work properly with output capturing.
2024-09-03 09:55:58 +02:00
Fabien Potencier c0f11545fd minor #4263 Fix testExtensionsAreNotInitializedWhenRenderingACompiledTemplate (derrabus)
This PR was merged into the 3.x branch.

Discussion
----------

Fix testExtensionsAreNotInitializedWhenRenderingACompiledTemplate

I stumbled over this test while checking for PHPUnit deprecations. In this case, we need to do something about the `setMethods()` call which has been removed in PHPUnit 11.

However, we add an expectation for a method `initExtensions()` which has been removed a long time ago. So, if that method was actually called, we'd get an error anyway. Expecting this method not to be called feels a little redundant. ~~This basically means, we can run this test against an unmocked `Environment`. But if we do so, the test does not really test what it's supposed to test which is why I decided to remove the whole test.~~

Update: Instead, I'm now registering an extension that throws if we try to initialize it.

Commits
-------

3a4d513f Fix testExtensionsAreNotInitializedWhenRenderingACompiledTemplate
2024-09-02 22:20:58 +02:00
Alexander M. Turek 3a4d513ffe Fix testExtensionsAreNotInitializedWhenRenderingACompiledTemplate 2024-09-02 20:07:39 +02:00
Fabien Potencier 6b37522774 minor #4264 Fix MacroTest (derrabus)
This PR was merged into the 3.x branch.

Discussion
----------

Fix MacroTest

Because of a typo in a variable name, `MacroTest` was never executed. This PR fixes the typo and adjusts the expected compiled PHP code, assuming that the current behavior is correct.

Commits
-------

1e5dea44 Fix MacroTest
2024-09-02 19:26:05 +02:00
Alexander M. Turek 1e5dea44f9 Fix MacroTest 2024-09-02 18:57:57 +02:00
Fabien Potencier ebb66610c9 Move back Environment::getGlobals() to public/internal 2024-09-02 17:23:35 +02:00
Fabien Potencier b7ded5c569 bug #4260 don't read current key and value when end of iterator is reached (xabbuh)
This PR was merged into the 4.x branch.

Discussion
----------

don't read current key and value when end of iterator is reached

see failures in symfony/symfony#58145

Commits
-------

12b4cdcf don't read current key and value when end of iterator is reached
2024-09-02 16:35:38 +02:00
Fabien Potencier 5513a89ec2 minor #4261 remove no longer needed PHP version checks (xabbuh)
This PR was merged into the 4.x branch.

Discussion
----------

remove no longer needed PHP version checks

Commits
-------

038d70f2 remove no longer needed PHP version checks
2024-09-02 16:34:36 +02:00
Fabien Potencier dad61f1960 minor #4262 Switch to expectUserDeprecationMessage() (derrabus)
This PR was merged into the 4.x branch.

Discussion
----------

Switch to expectUserDeprecationMessage()

This PR leverages symfony/symfony#54593. This will make it easier to switch to a vanilla PHPUnit 11 in the future.

Commits
-------

0ab26b08 Switch to expectUserDeprecationMessage()
2024-09-02 16:34:13 +02:00
Alexander M. Turek 0ab26b08b9 Switch to expectUserDeprecationMessage() 2024-09-02 15:38:53 +02:00
Christian Flothmann 038d70f2aa remove no longer needed PHP version checks 2024-09-02 15:38:31 +02:00
Christian Flothmann 12b4cdcf5e don't read current key and value when end of iterator is reached 2024-09-02 15:31:28 +02:00
Fabien Potencier 06ac86e3dd Merge branch '3.x' into 4.x
* 3.x:
  Fix tests
  Allow extra extensions to use Twig 4
2024-09-01 23:00:16 +02:00
Fabien Potencier 54590ec86b minor #4258 Allow extra extensions to use Twig 4 (on 3.x) (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Allow extra extensions to use Twig 4 (on 3.x)

Commits
-------

976cea04 Fix tests
031c7bda Allow extra extensions to use Twig 4
2024-09-01 22:59:50 +02:00
Fabien Potencier 976cea0403 Fix tests 2024-09-01 22:54:59 +02:00
Fabien Potencier 031c7bda4d Allow extra extensions to use Twig 4 2024-09-01 22:39:12 +02:00
Fabien Potencier 5e9d905866 Fix wrong merge 2024-09-01 09:48:10 +02:00
Fabien Potencier 05ea8f073c Merge branch '3.x' into 4.x
* 3.x:
  Only unset `_iterated` when there is an `else` node
2024-09-01 09:47:37 +02:00
Fabien Potencier d55f7adcbe minor #4257 Only unset _iterated when there is an else node (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Only unset `_iterated` when there is an `else` node

Same as #4249

Even though PHP does not complain, PHPStan does.
> Cannot unset offset '_iterated' on array{ ... the context values ... }

Since this is compiled code, we can easily produce a bit more valid code in the eyes of PHPStan.

Commits
-------

a16910e1 Only unset `_iterated` when there is an `else` node
2024-09-01 09:43:32 +02:00
Ruud Kamphuis a16910e14d Only unset _iterated when there is an else node
Same as #4249

Even though PHP does not complain, PHPStan does.
> Cannot unset offset '_iterated' on array{ ... the context values ... }

Since this is compiled code, we can easily produce a bit more valid code in the eyes of PHPStan.
2024-09-01 08:53:55 +02:00
Fabien Potencier 5c0b2d8478 Remove obsolete code 2024-08-30 20:45:16 +02:00
Fabien Potencier 35bb20ebac Merge branch '3.x' into 4.x
* 3.x:
  Adjust `cycle` implementation
  Fix CS
2024-08-30 20:44:20 +02:00
Fabien Potencier a39b6e164c minor #4241 Adjust cycle implementation (smnandre)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Adjust `cycle` implementation

Update code following [#4158](https://github.com/twigphp/Twig/issues/4158)
* return mixed
* trigger when non countable
* type the position argument

Add doc precisions

Commits
-------

7c3c1615 Adjust `cycle` implementation
2024-08-30 20:43:09 +02:00
Simon André 7c3c16154e Adjust cycle implementation 2024-08-30 20:43:06 +02:00
Fabien Potencier 938ee704b4 Fix CS 2024-08-30 16:22:35 +02:00
Fabien Potencier 18c548fe96 Fix merge 2024-08-30 16:22:11 +02:00
Fabien Potencier 573ccf0c13 Merge branch '3.x' into 4.x
* 3.x:
  Add more types to Template class and compiled templates
2024-08-30 16:18:52 +02:00
Fabien Potencier 375b477cb4 minor #4255 Add more types to Template class and compiled templates (ruudk)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add more types to Template class and compiled templates

Similar to https://github.com/twigphp/Twig/pull/4250.

Commits
-------

7e52a680 Add more types to Template class and compiled templates
2024-08-30 16:17:58 +02:00
Ruud Kamphuis 7e52a68097 Add more types to Template class and compiled templates 2024-08-30 16:17:55 +02:00
Fabien Potencier 5f1e1b56ce Merge branch '3.x' into 4.x
* 3.x:
  Remove unneeded whitespace
  Remove unneeded whitespace
2024-08-30 12:44:11 +02:00
Fabien Potencier 22abdfafae Remove unneeded whitespace 2024-08-30 12:44:06 +02:00
Fabien Potencier 2efb955ab5 Remove unneeded whitespace 2024-08-30 12:41:04 +02:00
Fabien Potencier b949556093 Fix merge 2024-08-30 12:39:46 +02:00
Fabien Potencier 61aa645a30 Merge branch '3.x' into 4.x
* 3.x:
  Fix doc markup
  Add an example on how to iterate over a string
  Remove NodeCaptureInterface from TypesNode
  Use CPP in full code base
  Add types tag
  Bump version
  Bump version
  Prepare the 3.12.0 release
  Fix CS
  Add conditional return types to `ensureTraversable`
  Add return type `isTraitable`
2024-08-30 12:38:56 +02:00
Fabien Potencier 08a571753b minor #4253 Document how to iterate over a string (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Document how to iterate over a string

Commits
-------

2f8c6218 Fix doc markup
a68804d6 Add an example on how to iterate over a string
2024-08-30 11:46:47 +02:00
Fabien Potencier 2f8c621898 Fix doc markup 2024-08-30 11:43:48 +02:00
Fabien Potencier a68804d614 Add an example on how to iterate over a string 2024-08-30 11:23:14 +02:00
Fabien Potencier 6cd8eb1c05 Simplify code 2024-08-30 08:52:54 +02:00
Fabien Potencier 18b4ceb987 minor #4254 Remove NodeCaptureInterface from TypesNode (ruudk)
This PR was merged into the 3.x branch.

Discussion
----------

Remove NodeCaptureInterface from TypesNode

This was accidentally copied from SetNode

Commits
-------

5e3f9d9f Remove NodeCaptureInterface from TypesNode
2024-08-29 20:08:45 +02:00
Ruud Kamphuis 5e3f9d9f26 Remove NodeCaptureInterface from TypesNode
This was accidentally copied from SetNode
2024-08-29 19:39:20 +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 8aedebee29 feature #4235 Add types tag (drjayvee)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Add types tag

The is a draft implementation for #4165.

Commits
-------

67dabd81 Add types tag
2024-08-29 19:26:49 +02:00
Jeroen Versteeg 67dabd8182 Add types tag 2024-08-29 19:26:49 +02:00
Fabien Potencier 9120e9f3d1 Bump version 2024-08-29 16:16:01 +02:00
Fabien Potencier edcea8bce0 Bump version 2024-08-29 11:53:10 +02:00
Fabien Potencier 4d19472d4a Prepare the 3.12.0 release v3.12.0 2024-08-29 11:51:12 +02:00
Fabien Potencier 33c4879dd8 Fix CS 2024-08-29 10:31:04 +02:00