This PR was merged into the 3.x branch.
Discussion
----------
Suppress native return type deprecation msg
> Method "Symfony\Component\DependencyInjection\Extension\ExtensionInterface::load()" might add "void" as a native return type declaration in the future. Do the same in implementation "Twig\Extra\TwigExtraBundle\DependencyInjection\TwigExtraExtension" now to avoid errors or add an explicit ``@return`` annotation to suppress this message.
Commits
-------
72d6f205 suppress native return type deprecation msg
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.
Discussion
----------
Making the Lexer initialize itself lazily, to avoid loading the extension set early
Hi!
Over on Symfony UX, we are pushing Twig in some crazy, "unconventional" ways by overriding the lexer to add a new HTML-like syntax - e.g. `<twig:Alert type="success">` - https://github.com/symfony/ux/blob/2.x/src/TwigComponent/src/Twig/ComponentLexer.php
Normally, the internal `Lexer` is not instantiated until it's needed - i.e. when a template is rendered. However, when overriding the lexer, our `ComponentLexer` needs to be instantiated early and set onto the `Environment`. And since it needs to extend `Lexer`, `Lexer::__construct()` is called much earlier than normal. One line in the constructor - https://github.com/twigphp/Twig/blob/f5ee1b6815a28fbab6e6fbb8c48b7964f0d93dd4/src/Lexer.php#L108 - causes the "extension set" to be loaded inside `Environment`. Some applications rely on being able to set extra Twig extensions after `Environment` is created, but before a template is rendered and our custom lexer currently breaks that.
So, the suggestion is to make the work inside `__construct()` done later. Everything is private, so I believe this is safe.
Cheers!
Commits
-------
2f7e8680 Making the Lexer initialize itself lazily, to avoid loading the extension set early
This PR was merged into the 3.x branch.
Discussion
----------
Put example all on one line
Fixes#3833
Commits
-------
9bb05aca Put example all on one line
This PR was merged into the 3.x branch.
Discussion
----------
return annotation to suppress deprecation warning
(finally PRed in the right repo - sorry about that)
> !! 2023-04-14T10:59:02+00:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "Twig\Extra\TwigExtraBundle\TwigExtraBundle" now to avoid errors or add an explicit ``@return`` annotation to suppress this message.
Commits
-------
b7a8ebbe return annotation to suppress deprecation warning
This PR was merged into the 3.x branch.
Discussion
----------
Add the new PHP 8.0 IntlDateFormatter::RELATIVE_* constants for date formatting.
Since PHP 8.0, IntlDateFormatter get new constants to format relative dates. This PR add those constants.
Commits
-------
5776f760 Add the new PHP 8.0 IntlDateFormatter::RELATIVE_* constants for date formatting.
This PR was submitted for the 3.x branch but it was squashed and merged into the 2.x branch instead.
Discussion
----------
Minor: Fixing language
Commits
-------
f52b45d2 Minor: Fixing language
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
pass the current key to reduce filter's callback
See #3802 for context.
Commits
-------
4f2f3f81 pass the current key to reduce filter's callback
This PR was merged into the 3.x branch.
Discussion
----------
Fix error messages in sandboxed mode for has some and has every
This has been forgotten when changing the PR to implement operators rather than filters.
Commits
-------
44c46712 Fix error messages in sandboxed mode for has some and has every
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Fix CHANGELOG
The title of #3670 is misleading, as the implementation changed from being a filter to an operator.
Also fixed some typos.
Commits
-------
dc693725 Fix CHANGELOG
This PR was merged into the 3.x branch.
Discussion
----------
Add "has some" and "has every" expressions documentation
Add documentation for https://github.com/twigphp/Twig/pull/3670.
Commits
-------
459ed67e Add "has some" and "has every" expressions