This PR was merged into the 3.x branch.
Discussion
----------
Deprecate the sandbox tag
Closes#3168
Commits
-------
9369a48c53 Deprecate the sandbox tag
This PR was merged into the 3.x branch.
Discussion
----------
Clarify docs on registerUndefinedTokenParserCallback()
Closes#3762
Commits
-------
d1b05519af Clarify docs on registerUndefinedTokenParserCallback()
This PR was merged into the 3.x branch.
Discussion
----------
Improve the way one can deprecate a Twig callable
Commits
-------
34ae0311d9 Improve the way one can deprecate a Twig callable
This PR was merged into the 3.x branch.
Discussion
----------
fix the version mergeGlobals() is deprecated since
Commits
-------
f72c93db fix the version mergeGlobals() is deprecated since
This PR was merged into the 3.x branch.
Discussion
----------
Add the possibility to reset globals
Closes#4007
Commits
-------
ef58791f Add the possibility to reset globals
This PR was merged into the 3.x branch.
Discussion
----------
Deprecate Environment::mergeGlobals()
Commits
-------
b86575cf Deprecate Environment::mergeGlobals()
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Fix wrong format of `Environment::VERSION_ID` constant
It seems that format of `Environment::VERSION_ID` constant was (erroneously?) changed with Twig 3.10.0.
Commits
-------
a219d9e7 Fix wrong format of `Environment::VERSION_ID` constant
This PR was merged into the 3.x branch.
Discussion
----------
Fix isset in ForLoopNode
Even though the code works perfectly fine, PHPStan doesn't understand it.
> Offset 'revindex0' does not exist on array{parent: array{index0: int<1, max>, index: int<2, max>, first: false, revindex0?: int, revindex?: int, length: int<0, max>, last?: bool}.
> Offset 'revindex' does not exist on array{parent: array{index0: int<1, max>, index: int<2, max>, first: false, revindex0: int, revindex?: int, length: int<0, max>, last?: bool}.
Since we want to work with `revindex` and `revindex0`, we can better check for their existence, instead of `length`.
/cc `@stof` `@fabpot`
Commits
-------
2b887e64 Fix isset in ForLoopNode
Even though the code works perfectly fine, PHPStan doesn't understand it.
Since we want to work with `revindex` and `revindex0`, we can better check for their
existence, instead of `length`.
This PR was merged into the 3.x branch.
Discussion
----------
Fix iterable return type
Currently, the PHPDoc states that a string should be returned, but that's not correct.
It can be anything that is echo-able.
That means any scalar, Stringable and even null.
/cc `@stof` `@fabpot`
Commits
-------
4cd8955f Fix iterable return type
Currently, the PHPDoc states that a string should be returned, but that's not correct.
It can be anything that is echo-able.
That means any scalar, Stringable and even null.
This PR was merged into the 3.x branch.
Discussion
----------
Improve exception expectations reliability
This PR moves exception expectations the closest possible to the line intended to throw. It improves reliability of tests ensuring that the right code is throwing the expected exception and not something else (resulting in false-positive). This has been done many times across Symfony code base.
Commits
-------
797e4903 Improve exception expectations reliability
This PR was merged into the 3.x branch.
Discussion
----------
Fix Xdebug detection
The ini setting `xdebug.overload_var_dump` has been removed in Xdebug 3. The `var_dump()` method is now always overloaded if the Xdebug runs in develop mode. I've adjusted our detection logic accordingly.
Since our minimum PHP version is 8.0 now, we can stop caring about Xdebug 2 which has never received a PHP 8 compatible release.
Commits
-------
1e87185d Fix Xdebug detection
This PR was merged into the 3.x branch.
Discussion
----------
Fix tests that don't perform assertions
The method `doesNotPerformAssertions()` is a getter that tells us if the current test is expected to perform assertions. I think the method that the author _wanted_ to call is `expectNotToPerformAssertions()` which tells PHPUnit not to complain if the current test does not perform any assertions.
Commits
-------
db22abfa Fix tests that don't perform assertions
This PR was merged into the 3.x branch.
Discussion
----------
Prepare IntegrationTestCase for static data providers
Data providers need to be static in PHPUnit 11. Because of this, I'd like to declare the two methods we use as data providers in `IntegrationTestCase` as static in 4.0. This PR prepares that change:
* The non-static `getFixturesDir()` method is replaced with a static `getFixturesDirectory()`.
* Both methods `getTests()` and `getLegacyTests()` are marked as final, so we can declare them static in the next major.
This however means that we're delaying PHPUnit 11 compatibility of integration tests to Twig 4.0. If that's too late for us, we could deprecate the whole `IntegrationTestCase` in favor of a compatible replacement. That's a bigger change, but I would work on it if you think it's worth it.
Commits
-------
18f42038 Prepare IntegrationTestCase for static data providers
This PR was merged into the 3.x branch.
Discussion
----------
Validate the input of CoreExtension::map()
Fixes https://github.com/twigphp/Twig/pull/4269#discussion_r1742182828
As discovered in #4269, we have a test that checks if the map filter fails if we pass a non-iterable value. However, this test relies on an active error handler that throws on PHP warnings.
This PR adds input validation the the `map()` function like we can already find it in similar functions.
Commits
-------
a035204a Validate the input of CoreExtension::map()
This PR was merged into the 3.x branch.
Discussion
----------
Make data providers static
Data providers must be static in PHPUnit 11. This PR fixes all the low hanging fruit.
Commits
-------
6ddb76bb Make data providers static
This PR was merged into the 3.x branch.
Discussion
----------
Rename AbstractTest to ProfilerTestCase
PHPUnit 11 doesn't allow abstract test classes to have the suffix "Test". This PR renames a class that violates that rule.
Commits
-------
fc20997c Rename AbstractTest to ProfilerTestCase