This PR was merged into the 3.x branch.
Discussion
----------
Make {} optional for the types tag
Closes#4532
Commits
-------
dff6fdd675 Make {} optional for the types tag
This PR was merged into the 3.x branch.
Discussion
----------
Remove the note about types mapping argument
Refs #4532
Commits
-------
36ff3fa3b8 Remove the note about types mapping argument
This PR was merged into the 3.x branch.
Discussion
----------
Add a note on the types locality
For your information `@drjayvee` `@ruudk`
Commits
-------
e7ae984e36 Add a note on the types locality
This PR was merged into the 3.x branch.
Discussion
----------
Add `getLastModified()` to extensions
Give to extensions the ability to set a last modification date for cache invalidation.
### Runtime
Currently, the cache is not invalidated when the signature of a runtime method is modified. This is an issue for templates that use named arguments, as argument names have an impact on the generated class.
With this change, extensions using runtime classes can compute a modification date by including the files on which they depend.
By default, the `AbstractExtension` checks if there is a file for the runtime class with the same name of the
This is the convention applied in [Symfony](https://github.com/symfony/symfony/tree/7.3/src/Symfony/Bridge/Twig/Extension) and Twig Extra: `MarkdownExtension` has `MarkdownRuntime`.
### Attribute
Contributing to https://github.com/twigphp/Twig/pull/3916.
The extension class that will get the configuration from attributes will be able to track the classes having attributes to find the last modification date of all this classes.
### ~BC break~
~In Twig 4.0, the method `getLastModified` will be added to `ExtensionInterface`. It is extremely rare to implement this interface without extending `AbstractExtension`. So adding this method to the interface shouldn't be a problem as the base class has an implementation.~
Commits
-------
d8fe3bd1ec Add `LastModifiedExtensionInterface` and implementation in `AbstractExtension` to track modification of runtime classes
This PR was merged into the 3.x branch.
Discussion
----------
Use spl_object_id() instead of spl_object_hash()
Small performance tweak.
Commits
-------
51bf2ca737 Use spl_object_id() instead of spl_object_hash()
This PR was merged into the 3.x branch.
Discussion
----------
Optimize NameExpression compilation
Commits
-------
efd12ef0cc Optimize NameExpression compilation
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Fix typo in enum twig doc functions
Commits
-------
3889bc7b18 Fix typo in enum twig doc functions
This PR was merged into the 3.x branch.
Discussion
----------
Fix MacroNode $name argument can be overridden
Fix#4515
Commits
-------
dc329fd44e Fix MacroNode $name argument can be overridden
This PR was merged into the 3.x branch.
Discussion
----------
Ignore exceptions from undefined handlers when using the guard tag
Fixes#4505
Commits
-------
b53c639f7d Ignore exceptions from undefined handlers when using the guard tag
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
[Doc] Update the docs about attribute() function
I Was fixing `filter` -> `function` error, but I realized that we could expand the docs of `attribute()` a bit, even if it's deprecated 🙏
Commits
-------
84daad9a27 [Doc] Update the docs about attribute() function
This PR was merged into the 3.x branch.
Discussion
----------
Add a way to stream template rendering
Even if we're using `yield` internally, there is no easy way to stream template rendering. This new method can be used like this to HTTP stream a template with Symfony:
```php
use Symfony\Component\HttpFoundation\StreamedResponse;
use Twig\Environment;
$twig = new Environment(/* ... */);
$response = new StreamedResponse($twig->load('index')->stream([]));
$response->send();
```
Commits
-------
1915ee2812 Add a way to stream template rendering
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Use .html.twig file extension in documentation instead of .html
Use .html.twig file extensions instead of .html
Commits
-------
03792f643f Use .html.twig file extension in documentation instead of .html
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
adds support for invoking closures
- fixes#3848
Commits
-------
0a61801d9a adds support for invoking closures
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Change `=` to `:` for named arguments
Hi,
I changed `=` to `:` because it better follows best practices for named arguments.
Commits
-------
99ea35e1e8 Change `=` to `:` for named arguments