Commit Graph

77 Commits

Author SHA1 Message Date
Fabien Potencier 07b8427e26 Merge branch '3.x' into 4.x 2026-09-25 18:04:23 +02:00
Nicolas Grekas d3d13f9b1a Speed up adding extensions to an environment 2026-09-24 18:47:14 +02:00
Fabien Potencier 3c89f82d4a Cleanup 4.x - Stop detecting echo and print in compiled nodes 2026-09-23 10:50:26 +01:00
Fabien Potencier 10adb67bcf Remove deprecated code 2026-09-22 21:17:13 +01:00
Fabien Potencier a38543b5a3 Fix merge conflict resolution 2026-09-22 21:14:25 +01:00
Fabien Potencier f3bacf3877 Merge branch '3.x' into 4.x
* 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
2026-09-22 21:10:53 +01:00
Fabien Potencier 6f94a47ce1 Reuse the template wrapper of an already loaded template 2026-09-22 21:02:38 +01:00
Fabien Potencier 55afb2e084 Deprecate cloning a Twig environment 2026-09-18 16:52:58 +01:00
Fabien Potencier 6123bfe4ee Merge branch '3.x' into 4.x
* 3.x:
  Reject cross-environment template wrappers in block chains
  Reject cross-environment template wrappers

# Conflicts:
#	CHANGELOG
#	tests/TemplateTest.php
2026-09-14 14:13:36 +02:00
Fabien Potencier c1fc112047 Reject cross-environment template wrappers 2026-09-12 09:51:36 +02:00
Fabien Potencier 5ca7debf6e Fix merge conflict resolution 2026-07-12 15:08:38 +02:00
Fabien Potencier 0b6e824ea8 Merge branch '3.x' into 4.x
* 3.x:
  Add void return type hint even in tests
  Run php-cs-fixer sequentially so the void_return src-only customiser is applied
  Fix CHANGELOG
  [Intl] Add format_list filter using PHP 8.5's IntlListFormatter

# Conflicts:
#	.github/workflows/ci.yml
#	CHANGELOG
#	extra/cssinliner-extra/Tests/LegacyFunctionsTest.php
#	extra/html-extra/Tests/CvaTest.php
#	extra/html-extra/Tests/HtmlAttrMergeTest.php
#	extra/html-extra/Tests/HtmlAttrTest.php
#	extra/html-extra/Tests/LegacyFunctionsTest.php
#	extra/inky-extra/Tests/LegacyFunctionsTest.php
#	extra/markdown-extra/Tests/FunctionalTest.php
#	extra/markdown-extra/Tests/LegacyFunctionsTest.php
#	extra/twig-extra-bundle/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php
#	extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php
#	extra/twig-extra-bundle/TwigExtraBundle.php
#	src/Extension/CoreExtension.php
#	src/Extension/EscaperExtension.php
#	src/Node/CheckSecurityCallNode.php
#	src/Node/Expression/FunctionExpression.php
#	src/Node/ModuleNode.php
#	src/Node/Node.php
#	src/Node/TypesNode.php
#	src/Resources/core.php
#	src/Resources/debug.php
#	src/Test/IntegrationTestCase.php
#	tests/CustomExtensionTest.php
#	tests/EnvironmentTest.php
#	tests/ExpressionParserTest.php
#	tests/Extension/CoreTest.php
#	tests/Extension/EscaperTest.php
#	tests/Extension/LegacyDebugFunctionsTest.php
#	tests/Extension/LegacyStringLoaderFunctionsTest.php
#	tests/Extension/SandboxStateChangeTest.php
#	tests/Extension/SandboxTest.php
#	tests/LexerTest.php
#	tests/Node/Expression/CallTest.php
#	tests/Node/Expression/ConditionalTest.php
#	tests/Node/NodeTest.php
#	tests/Resources/LegacyCoreTest.php
#	tests/TemplateTest.php
#	tests/Util/CallableArgumentsExtractorTest.php
2026-07-12 13:55:37 +02:00
Fabien Potencier 9c6d76b61c Add void return type hint even in tests 2026-07-12 13:43:08 +02:00
Fabien Potencier 971dbcfe92 Fix merge conflict resolution 2026-06-03 19:55:20 +02:00
Fabien Potencier 455be2c916 Merge branch '3.x' into 4.x
* 3.x:
  Add PHPUnit attributes alongside annotations to silence doc-comment metadata deprecations on PHPUnit 11
  Run the test suite against PHPUnit 11.3 in CI
  Make IntegrationTestCase and NodeTestCase compatible with PHPUnit 11

# Conflicts:
#	CHANGELOG
#	src/Test/IntegrationTestCase.php
#	src/Test/NodeTestCase.php
#	tests/Cache/ChainTest.php
#	tests/CustomExtensionTest.php
#	tests/DeprecatedCallableInfoTest.php
#	tests/EnvironmentTest.php
#	tests/ErrorTest.php
#	tests/ExpressionParserTest.php
#	tests/Extension/AttributeExtensionTest.php
#	tests/Extension/CoreTest.php
#	tests/Extension/EscaperTest.php
#	tests/Extension/LegacyDebugFunctionsTest.php
#	tests/Extension/LegacyStringLoaderFunctionsTest.php
#	tests/Extension/SandboxStateChangeTest.php
#	tests/Extension/SandboxTest.php
#	tests/FileExtensionEscapingStrategyTest.php
#	tests/LexerTest.php
#	tests/Loader/FilesystemTest.php
#	tests/Node/Expression/CallTest.php
#	tests/Node/Expression/ConditionalTest.php
#	tests/Node/Expression/MacroReferenceTest.php
#	tests/Node/Expression/NullCoalesceTest.php
#	tests/Node/NodeTest.php
#	tests/NodeVisitor/OptimizerTest.php
#	tests/ParserTest.php
#	tests/Resources/LegacyCoreTest.php
#	tests/Runtime/EscaperRuntimeTest.php
#	tests/TemplateTest.php
#	tests/TokenParser/TypesTokenParserTest.php
#	tests/Util/CallableArgumentsExtractorTest.php
#	tests/Util/CallableParametersTest.php
2026-06-03 19:54:02 +02:00
Fabien Potencier 8a4b77920a Add PHPUnit attributes alongside annotations to silence doc-comment metadata deprecations on PHPUnit 11 2026-06-03 18:26:39 +02:00
Fabien Potencier cdce18d02a Fix CS 2026-02-07 09:16:06 +01:00
Fabien Potencier 0facb551b0 Merge branch '3.x' into 4.x
* 3.x:
  Fix CS
2026-02-07 09:12:05 +01:00
Fabien Potencier 861215c507 Fix CS 2026-02-07 09:07:38 +01:00
Fabien Potencier b03de9de05 Merge branch '3.x' into 4.x
* 3.x:
  Update CHANGELOG
  Fix accessing arrays with stringable objects as key
  Update inky_to_html.rst: Updating link
  Update replace.rst
  [Doc] Tweaks in the escaping article
  Compile 'index' with repr (not string) in EmbedNode
  Introduce registerUndefinedTestCallback
  Fix intl test
  Bump minimum Commonmark requirement
  Support two words test guard
  Bump version
  Improve documentation examples for `enum` and `enum_cases`
  Avoid errors when failing to guess the template info for an error
  Add note to format_datetime explaining how to install required extensions
  Fix compatibility layer
2025-10-29 11:55:46 -04:00
Vincent Langlet cc12df995c Introduce registerUndefinedTestCallback 2025-09-16 07:40:27 +02:00
Nicolas Grekas c649c1658b Merge branch '3.x' into 4.x
* 3.x:
  CS fixes
  Enable Fabbot as a GHA
2025-07-29 10:27:55 +02:00
Nicolas Grekas 85a4817128 CS fixes 2025-07-29 10:07:07 +02:00
Fabien Potencier 151aa4ecda Fix CS 2025-02-14 12:57:03 +01:00
Fabien Potencier 6032fd320c Merge branch '3.x' into 4.x
* 3.x:
  Fix version
  Fix CS
  Remove obsolete code
  Use generics in ExpressionParsers
  Fix precedence rules
  Add deprecation notices in CHANGELOG and docs
  Move Operators to ExpressionParsers, deprecate ExpressionParser
  Add a script to update operator precedence documentation
  Extract operators logic from ExpressionParser to their own classes
  Introduce operator classes to describe operators provided by extensions instead of arrays
  Bump version to 3.21
2025-02-14 09:08:33 +01:00
Fabien Potencier 4b57f48a65 Use generics in ExpressionParsers 2025-02-14 08:38:53 +01:00
Fabien Potencier f67078b5c4 Move Operators to ExpressionParsers, deprecate ExpressionParser 2025-02-14 08:38:53 +01:00
Fabien Potencier df877a1d53 Introduce operator classes to describe operators provided by extensions instead of arrays 2025-02-14 08:38:53 +01:00
Fabien Potencier 28246c5d4e Merge branch '3.x' into 4.x
* 3.x:
  Fixing minor typo in Update inline_css.rst
  Ignore static properties when using the dot operator
  Fix CS
  Fix constant() behavior when used with ??
  Finish the work
  fix indentation
  Apply suggestions from code review
  typo
  fix merge
  docs and changelog
  typehint instead of checkArrow
  checkArrow, typehints
  invoke filter
2025-01-24 11:32:17 +01:00
Fabien Potencier 76062c8d51 Fix CS 2025-01-19 16:54:05 +01:00
Fabien Potencier 9d9c9d81e9 Improve YieldReady support docs 2024-11-11 09:38:36 +01:00
Fabien Potencier 14216a8d68 Merge branch '3.x' into 4.x
* 3.x:
  Deprecate using the not unary operator without parenthesis
  Deprecate using ?? without explicit parentheses
  Add support for logical `xor` operator
  Allow running CI on all branches
  [Doc] Fix enum title
  Document Twig vs PHP types
2024-10-02 14:19:28 +02:00
Fabien Potencier 2081b1ff74 Deprecate using the not unary operator without parenthesis 2024-10-02 14:16:34 +02:00
Fabien Potencier f4aacafd78 Deprecate using ?? without explicit parentheses 2024-10-01 21:58:05 +02:00
Fabien Potencier 4dd20ba005 Merge branch '3.x' into 4.x
* 3.x:
  Add start/end time accessors on Profile
  Fix 'ignore missing' when used on an 'embed' tag
  Fix the possibility to override an aliased block (via use)
  Add test
  Add hot cache reload for templates
  Add RemovableCacheInterface
  Add some tests
  Optimize compiled code for "set" tag
  Improve how trim behaves
  Add more tests
  Add return types in FileystemLoader
  Add compile-time checks for the "matches" operator
2024-09-26 09:28:03 +02:00
Fabien Potencier 00ba8046b0 Add test 2024-09-25 17:28:51 +02:00
Fabien Potencier 76ef266cd7 Merge branch '3.x' into 4.x
* 3.x:
  Add the possibility to reset globals
2024-09-07 17:16:15 +02:00
Fabien Potencier fa1c9f0bf9 Merge branch '3.x' into 4.x
* 3.x:
  Remove obsolete code
  Deprecate Environment::mergeGlobals()
  Bump version
  Prepare the 3.13.0 release
  Fix wrong format of `Environment::VERSION_ID` constant
  Fix minor things
  Fix CS
  Fix isset in ForLoopNode
  Fix iterable return type
  Improve exception expectations reliability
2024-09-07 17:03:10 +02:00
Fabien Potencier ef58791fa4 Add the possibility to reset globals 2024-09-07 16:47:00 +02:00
Fabien Potencier f5300784df bug #4281 Fix wrong format of Environment::VERSION_ID constant (emodric)
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
2024-09-06 13:47:41 +02:00
Edi Modrić a219d9e77f Fix wrong format of Environment::VERSION_ID constant 2024-09-06 13:47:39 +02:00
Fabien Potencier 2ae0c0d38c Fix CS 2024-09-06 12:33:38 +02:00
Alexandre Daubois 797e490356 Improve exception expectations reliability 2024-09-04 15:22:48 +02:00
Fabien Potencier cc1045e4e4 Merge branch '3.x' into 4.x
* 3.x:
  Replace `return; yield` with `yield from []`
  Fix testExtensionsAreNotInitializedWhenRenderingACompiledTemplate
  Fix MacroTest
2024-09-03 13:55:51 +02:00
Alexander M. Turek 3a4d513ffe Fix testExtensionsAreNotInitializedWhenRenderingACompiledTemplate 2024-09-02 20:07:39 +02:00
Fabien Potencier e2f0128774 Merge branch '3.x' into 4.x
* 3.x:
  Deprecate the fact that the `extends` and `use` tags are always allowed in a sandboxed template
  Clarify block function
2024-08-28 13:56:42 +02:00
Fabien Potencier 5fca700cbd Deprecate the fact that the extends and use tags are always allowed in a sandboxed template 2024-08-28 13:40:53 +02:00
Fabien Potencier 5820fba263 Merge branch '3.x' into 4.x
* 3.x:
  Update CHANGELOG and docs
  Swap BC layer for yield-ready and reclaim perf loss
  Add test about version
2024-08-19 20:19:25 +02:00
Vincent Langlet 254abc8c4c Add test about version 2024-08-18 18:25:33 +02:00
Simon André 470965fcc2 Add missing return types in 4.0 2024-08-17 23:10:07 +02:00