This PR was merged into the 4.x branch.
Discussion
----------
Fix the CHANGELOG entry about Environment::getGlobals()
Commits
-------
eb5687a248 Fix the CHANGELOG entry about Environment::getGlobals()
This PR was squashed before being merged into the 4.x branch.
Discussion
----------
4.x cleanup
Commits
-------
4493d0747a Merge the CHANGELOG entries about the inert attributes
2a16651387 Explain that the inert attribute classes are kept for static analysis, not class loading
991294ae39 Drop the 3.x version from the SandboxExtension internal annotation
69a4e43f0a Remove the inert FirstClassTwigCallableReady attribute from the built-in nodes
bb0dbfc229 Stop passing the template source to the sandbox checks that no longer use it
a5abf30b19 Remove the deprecation getters from TwigCallableInterface
dbfd06ffba Make Markup final
40b0349558 Run the attribute function fixtures as regular integration tests
6b7dfe3dcc Remove outdated references to older Twig versions
ea98cfa8c8 Remove the static test container fallback from the extra bundle integration test
57ef149e3b Remove the League CommonMark fallback for converters without convert()
This PR was merged into the 4.x branch.
Discussion
----------
Remove the opcache preload hint for a class ExtensionSet no longer extends
Commits
-------
221e5eaa8c Remove the opcache preload hint for a class ExtensionSet no longer extends
This PR was merged into the 3.x branch.
Discussion
----------
Rewrite the sandbox documentation around what developers need to know
Commits
-------
9d24327f8d Rewrite the sandbox documentation around what developers need to know
This PR was merged into the 3.x branch.
Discussion
----------
Skip the property checker call and memoize the class constant probe when reading an object attribute
Commits
-------
ddd9045b5c Skip the property checker call and memoize the class constant probe when reading an object attribute
This PR was merged into the 3.x branch.
Discussion
----------
Stop looking up a macro twice in its own namespace when it is declared by a parent
Commits
-------
e3f0d6fb4c Stop looking up a macro twice in its own namespace when it is declared by a parent
This PR was merged into the 3.x branch.
Discussion
----------
Fetch the escaper runtime once in the constructor of templates that escape
Commits
-------
3417f483bf Fetch the escaper runtime once in the constructor of templates that escape
This PR was merged into the 3.x branch.
Discussion
----------
Compare the date formatter prototype pattern with the derived one once per pattern
Commits
-------
10fe9808bb Compare the date formatter prototype pattern with the derived one once per pattern
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Fix split trailing newline
Commits
-------
00861d50ab Fix split trailing newline
This PR was merged into the 3.x branch.
Discussion
----------
Speed up adding extensions to an environment
`Environment::addExtension()` recomputes the options hash on every call, JSON-encoding the class names of all the extensions registered so far. This computes it only when a template class name is needed. With the 24 extensions TwigBundle registers on the Symfony Demo, building the environment drops from 87µs to 19µs, and calling `setExtensions()` once instead brings nothing more.
Merge-up to 4.x: the property is typed there, so it has to become `private ?string $optionsHash = null;` (I ran the 4.x suite with that change). The CHANGELOG entry doesn't go to 4.x.
Commits
-------
d3d13f9b1a Speed up adding extensions to an environment
This PR was squashed before being merged into the 4.x branch.
Discussion
----------
Cleanup 4.x - Stop detecting echo and print in compiled nodes
Commits
-------
3c89f82d4a Cleanup 4.x - Stop detecting echo and print in compiled nodes
This PR was merged into the 3.x branch.
Discussion
----------
Reuse the already resolved callable when compiling call arguments
Commits
-------
16be8af8f5 Reuse the already resolved callable when compiling call arguments
This PR was merged into the 3.x branch.
Discussion
----------
Compile the generator guard as an unreachable yield instead of a yield from
Commits
-------
4d5d233776 Compile the generator guard as an unreachable yield instead of a yield from
* 3.x:
Reuse the template wrapper of an already loaded template
Stop the escaping safe analysis from retaining every analyzed node
Allow to call TemplateWrapper::unwrap() without arguments
Expose the escaping strategy a template was compiled with
Improve macro call performance
Fix IntlExtension inheriting values derived by ICU from a date formatter prototype
Fix array access with a Stringable key on subclasses of ArrayObject and ArrayIterator
Ignore the PHPUnit 10+ cache directory
Cover and document the matches operator throwing on an invalid UTF-8 subject
Report a clear error when a string cannot be split into characters
Deprecate cloning a Twig environment
Report the macro call parentheses deprecation once per call site and name the macro
Bump version
Prepare the 3.29.0 release
Update CHANGELOG
# Conflicts:
# .gitignore
# CHANGELOG
# doc/deprecated.rst
# src/Environment.php
# src/NodeVisitor/CorrectnessNodeVisitor.php
# src/NodeVisitor/SafeAnalysisNodeVisitor.php
# src/Template.php
# tests/Fixtures/macros/call_without_parentheses.legacy.test
# tests/ParserTest.php
# tests/TemplateTest.php
# tests/TwigMacroTest.php
This PR was merged into the 3.x branch.
Discussion
----------
Speed up loading a template that the environment has already loaded
`Environment::load()` allocated a fresh `TemplateWrapper` on every call, even when the template was already loaded. Since `TemplateWrapper` is immutable, the same instance can be reused.
**Performance** (PHP 8.5, interleaved A/B, min of 5 runs):
| Workload | Before | After | |
|---|---:|---:|---:|
| Repeated `load()` of a loaded template | ~800 ns | ~610 ns | **−24%** |
| Page render: layout + 41 `include()` calls | 133 µs | 127 µs | **−5%** |
Commits
-------
6f94a47ce1 Reuse the template wrapper of an already loaded template
This PR was merged into the 3.x branch.
Discussion
----------
Stop the escaping safe analysis from retaining every analyzed node
Commits
-------
8274571d04 Stop the escaping safe analysis from retaining every analyzed node