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 []`
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
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
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
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
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()
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
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
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.
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
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
* 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`
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
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
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
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