Commit Graph

212 Commits

Author SHA1 Message Date
Fabien Potencier f640320202 Merge branch '3.x' into 4.x
* 3.x: (26 commits)
  Remove the documentation comments compilation overhead
  Clarify source function trust requirements
  Throw on PCRE errors in the matches operator
  Document that reusing a non-rewindable iterator after destructuring is unsupported
  Release destructuring temporaries after assignment
  Deprecate prefixed macro definedness checks
  Fix duplicate macro deprecation wording
  Throw when list formatting fails
  Document that sequence destructuring consumes one value per pattern slot
  Fix the html_attr documentation about iterables in data attributes
  Warn about untrusted input with the default Tempest markdown converter
  Document that overriding MacroNode::compile() is not supported anymore
  Merge overlapping CHANGELOG entries for the destructuring fatal error fix
  Document that include_only keeps global variables available
  Remove lazy macro import resolution
  Honor date formatter prototype calendars
  Fix Stringable keys for ArrayAccess implementations
  Fix repeated object destructuring evaluation
  Restore void return type compatibility for extension points
  Reject destructuring patterns containing no variables
  ...

# Conflicts:
#	CHANGELOG
#	doc/deprecated.rst
#	doc/filters/format_datetime.rst
#	extra/twig-extra-bundle/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php
#	extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php
#	extra/twig-extra-bundle/TwigExtraBundle.php
#	src/MacroNamespace.php
#	src/Node/MacrosNode.php
#	src/Parser.php
#	src/Test/IntegrationTestCase.php
#	src/Test/NodeTestCase.php
#	tests/CallMacroTest.php
#	tests/ExpressionParserTest.php
#	tests/Fixtures/macros/duplicate_definition.legacy.test
#	tests/Node/MacrosTest.php
#	tests/ParserTest.php
2026-08-29 00:25:20 +02:00
Fabien Potencier fdfef2b14a Clarify source function trust requirements 2026-08-28 18:11:30 +02:00
Fabien Potencier abbdf82823 Fix the html_attr documentation about iterables in data attributes 2026-08-27 13:07:41 +02:00
Fabien Potencier 207f873739 Document that include_only keeps global variables available 2026-08-27 13:07:13 +02:00
Hugo Alliaume 9b18e3757d Extract htmlAttrValue() from html_attr for standalone attribute rendering 2026-08-26 16:46:53 +02:00
Fabien Potencier c4d77c9847 Remove versionadded in docs 2026-08-17 20:19:13 +02:00
Fabien Potencier 60d3b3452a Merge branch '3.x' into 4.x
* 3.x:
  Add support for tempest/markdown in markdown-extra
  Add the include_only function to render a template without access to the current context
  Clarify duplicate macro deprecation message
  Deduplicate template error handling

# Conflicts:
#	.gitignore
#	CHANGELOG
#	extra/markdown-extra/composer.json
#	src/Extension/CoreExtension.php
#	src/Parser.php
#	src/Template.php
#	tests/Fixtures/macros/duplicate_definition.legacy.test
2026-08-16 10:57:50 +02:00
Fabien Potencier dc8f96df3e Add the include_only function to render a template without access to the current context 2026-08-11 20:58:31 +02:00
Fabien Potencier b34f022583 Remove deprecated code 2026-07-30 13:52:37 +02:00
Fabien Potencier 3197df7b5e Merge branch '3.x' into 4.x
* 3.x:
  Make the sandbox a first-class citizen with a dedicated Sandbox class

# Conflicts:
#	CHANGELOG
#	doc/deprecated.rst
#	doc/tags/sandbox.rst
#	phpstan-baseline.neon
#	src/Extension/CoreExtension.php
#	src/Extension/SandboxExtension.php
#	src/Sandbox/SecurityPolicy.php
2026-07-30 13:04:50 +02:00
Fabien Potencier b762bc94b9 Make the sandbox a first-class citizen with a dedicated Sandbox class 2026-07-30 12:05:47 +02:00
Fabien Potencier 16a7e4ec0d Merge branch '3.x' into 4.x
* 3.x:
  Document how to customize the markdown_to_html converter
  Make the include() function return a Markup object
  Fix nested block() resolution when a directly rendered block calls parent()
  Fix nested block() resolution when a directly rendered block calls parent()
  Document storing an enum in a variable to avoid repeating its FQCN
  Stop reporting a skipped test in IntegrationTestCase when there is no legacy test to run
  Document {#--#} as the replacement for the deprecated spaceless filter
  Skip the string cast in PrintNode when the expression is already a string and add tests
  Ensure PrintNode is yielding string content
  CoreExtension::getAttribute: small improvement regarding getter/isser/hasser

# Conflicts:
#	CHANGELOG
#	tests/Node/ForTest.php
2026-06-06 08:48:52 +02:00
Fabien Potencier a3eda4b1fd Make the include() function return a Markup object 2026-06-04 21:32:12 +02:00
Fabien Potencier e1178abfa1 Document storing an enum in a variable to avoid repeating its FQCN 2026-06-03 21:58:29 +02:00
Fabien Potencier f3e9b55805 Remove deprecated code 2026-05-23 11:27:44 +02:00
Fabien Potencier cbaa485734 Remove 3.x deprecation warning from attribute function docs 2026-05-21 14:53:50 +02:00
Fabien Potencier 4eb02560ea Remove versionadded in docs 2026-05-21 14:45:29 +02:00
Fabien Potencier 8dd0383353 Merge branch '3.x' into 4.x
* 3.x: (23 commits)
  Bump version
  Prepare the 3.26.0 release
  Update CHANGELOG
  Document that the sandbox doesn't protect against resource exhaustion
  Document template_from_string caveats when used in a sandboxed env
  Pre-escape HTML input on the `spaceless` filter
  Add docs on Markup about the goal of this class in the context of a sandbox
  Fix sandbox bypass in the "column" filter
  Fix sandbox `__toString` bypasses
  Validate macro name in MacroReferenceExpression constructor
  Fix sandbox bypass: PHP code injection via _self / import macro reference
  Fix deprecations in tests
  Fix sandbox bypass in the `{% sandbox %}` tag when including a preloaded template
  Encode single quotes as \x27 in Compiler::string()
  Fix sandbox bypass: PHP code injection via {% use %} template name
  Fix unbounded memoisation of `IntlDateFormatter` / `NumberFormatter`
  Fix deprecation
  [Profiler] Escape template and profile names in HtmlDumper
  Bump version
  Fix sandbox bypass: propagate sandbox state to checkArrow for source-policy sandboxing
  ...

# Conflicts:
#	CHANGELOG
#	doc/filters/spaceless.rst
#	extra/cssinliner-extra/CssInlinerExtension.php
#	extra/inky-extra/InkyExtension.php
#	extra/markdown-extra/MarkdownExtension.php
#	src/Environment.php
#	src/ExpressionParser/Infix/DotExpressionParser.php
#	src/Extension/CoreExtension.php
#	src/Node/Expression/FilterExpression.php
#	src/Node/Expression/FunctionExpression.php
#	src/Node/Expression/TestExpression.php
#	src/Node/ModuleNode.php
#	src/NodeVisitor/SandboxNodeVisitor.php
#	src/Resources/core.php
#	src/TokenParser/SandboxTokenParser.php
#	tests/Extension/SandboxTest.php
2026-05-21 13:58:45 +02:00
Fabien Potencier 1cde8f2b62 Document template_from_string caveats when used in a sandboxed env 2026-05-20 08:43:49 +02:00
Fabien Potencier 0c515667d2 Merge remote-tracking branch 'origin/3.x' into 4.x
* origin/3.x:
  Add a `needs_is_sandboxed` option for filters, functions, and tests
  Bump version
  Make embeds deterministic
  [Doc] Document loose comparison in the `in` operator
  [Doc] Reword whitespace control note about first-newline removal
  Stop publishing extra package minor versions with no changes
  Lazy load EscaperRuntime in EscaperExtension
  Fix typo
  Replace parent-child analogy in `doc/tags/extends.rst`
  doc: Add missing toctree entries and fix ordering
  Fix CHANGELOG
  Bump version
  Prepare the 3.24.0 release
2026-05-17 08:18:04 +01:00
Fabien Potencier f3d5a9f071 Fix typo 2026-03-22 10:08:53 +01:00
Fabien Potencier b2204b9a72 Merge branch '3.x' into 4.x
* 3.x:
  Add an `html_attr` function to make outputting HTML attributes easier
  fix MatchesBinary namespace in changelog
2026-03-17 07:40:40 +01:00
Matthias Pigulla 42c12fa720 Add an html_attr function to make outputting HTML attributes easier 2026-03-17 07:39:33 +01:00
Fabien Potencier 0222460a72 Merge branch '3.x' into 4.x
* 3.x:
  Bump version
  Add a not about the return value of destructuring
  Fix null-safe operator test
  Bump version
  Prepare the  release
  Update CHANGELOG
  Add support for object and mapping destructuring
  Rename classes
  Assignment operator array destructuring
  Fix doc notes
  Fix doc notes
  Add the = assignment operator
  Fix grammar and spelling mistakes in documentation
2026-02-06 22:45:48 +01:00
Fabien Potencier 77cd2fd9f7 Fix grammar and spelling mistakes in documentation 2026-01-17 22:34:06 +01:00
Fabien Potencier 280960d9e1 Merge branch '3.x' into 4.x
* 3.x:
  Fix documentation for getOperators()
  bump version
  Enhance enum.rst with dynamic case example
  Add === and !== operators
  Update extends.rst
  Fix spread operator behavior
2026-01-17 10:24:43 +01:00
Hugo Alliaume bcc5ffc301 Enhance enum.rst with dynamic case example 2026-01-14 22:26:11 +01:00
Fabien Potencier 56a7aa4e4f Merge branch '3.x' into 4.x
* 3.x:
  use getShareDir as an indicator of Symfony version
  Add 'invoke' to filters index
  [Core] Fix cycle() with non-countable ArrayAccess+Traversable objects
  Update .gitattributes to exclude phpstan configs
  Bump version
  Prepare the 3.22.1 release
  Update CHANGELOG
  `CoreExtension` : Make error message more readable
  Add caution note for random function usage
  Add throw tag to parse methods
2025-12-05 09:58:08 +01:00
Andreas Erhard 02c5a4b0b6 Add caution note for random function usage 2025-11-04 11:55:35 +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
Hugo Alliaume def4abbd5e Improve documentation examples for enum and enum_cases
It may be obvious, but I first thought initializing an BackendEnum with a certain value could be possible with `enum(FQCN, value)`, but it does not, it always returns the first case  instance (if exists).

Instead, `enum(FQCN).from(value)` must be used, I think it's worth to improve `enum()` examples.
2025-09-12 18:14:50 +02:00
Nicolas Grekas c2b04ec6d9 Merge branch '3.x' into 4.x
* 3.x:
  Escaper performance: avoid static variables
  Fix compatibility with Symfony 8
  Add documentation for use_yield option
  Stof suggestion about empty content
  Update templates.rst: Removing duplication
  Update configuration keys + allow extra keys for extensions
  replace typographic quote with straigt single quote
  Add TwigCsFixer in tools list
  Update reduce.rst
  Bump version
  Prepare the 3.21.1 release
  Update CHANGELOG
  Fix warning
  Fix instantiation
2025-07-29 10:22:22 +02:00
Christian Flothmann 057ea92274 replace typographic quote with straigt single quote
make DOCtor-RST 1.68 happy and account for OskarStark/doctor-rst#2011
2025-05-17 21:08:00 +02:00
Fabien Potencier fb15117507 Merge branch '3.x' into 4.x
* 3.x:
  Bump version
  Prepare the 3.21.0 release
  Tweaks html_cva docs
  Update CHANGELOG
  Create attributes `AsTwigFilter`, `AsTwigFunction` and `AsTwigTest` to ease extension development
  Update html_cva.rst
2025-05-02 15:21:23 +02:00
Fabien Potencier f14f2208f9 Tweaks html_cva docs 2025-03-30 09:51:16 +02:00
Fabien Potencier 7b2fe7cf14 minor #4613 Update html_cva.rst (seb-jean)
This PR was merged into the 3.x branch.

Discussion
----------

Update html_cva.rst

Commits
-------

1a46d12033 Update html_cva.rst
2025-03-30 09:50:03 +02:00
Fabien Potencier bf65bf2948 Merge branch '3.x' into 4.x
* 3.x:
  Fix wrong array index (again)
  fix: update extension references in docs to use backticks
  [Doc] Fix `code-block` in html_cva
  [Docs] Replace `=` by `:` in code examples
  fix: deprecated documentation
  Use `:` instead of `=` for named argument in the docs
  use EmptyNode instead of an Nodes instance without children
  Fix `ModuleNode` instanciation when `$embeddedTemplates` is null
  merge the Nodes and Node sections
  reduce the number of deprecations being triggered
2025-03-21 10:08:16 +01:00
Fabien Potencier 77a6da9cc7 minor #4616 [Docs] Replace = by : in code examples (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

[Docs] Replace `=` by `:` in code examples

Replace `=` by `:` in code examples
* function/include
* filters/format_number

Commits
-------

84b0499dbd [Docs] Replace `=` by `:` in code examples
2025-03-20 22:33:01 +01:00
Simon André a7c0482dc9 [Doc] Fix code-block in html_cva
There is no `terminal` code-block in the current Twig documentation.

Using `bash` here instead is more in line with the other pages.

(...and will allow to simplify CSS needed for code blocks)
2025-03-20 07:30:17 +01:00
Simon André 84b0499dbd [Docs] Replace = by : in code examples
* function/include
* filters/format_number
2025-03-20 07:23:44 +01:00
seb-jean 1a46d12033 Update html_cva.rst 2025-03-12 18:12:07 +01:00
Jacob Dreesen ccec90c85c Use : instead of = for named argument in the docs 2025-03-06 17:34:44 +01:00
Fabien Potencier dd69b12bfe Merge branch '3.x' into 4.x
* 3.x:
  [SECURITY] Fix a security issue where escaping was missing when using ??
  Fix typo for html_cva code example
2025-01-29 07:59:13 +01:00
Matthieu Pétel 83da53c3f1 Fix typo for html_cva code example
Fix a typo where 'red' should be 'blue' according to the above code.
2025-01-28 10:51:09 +01:00
Fabien Potencier ef7ade8ee3 Merge branch '3.x' into 4.x
* 3.x: (30 commits)
  Make {} optional for the types tag
  Remove the note about types mapping argument
  Add a note on the types locality
  Fix CS
  Fix typos in the docs
  Use spl_object_id() instead of spl_object_hash()
  Add `LastModifiedExtensionInterface` and implementation in `AbstractExtension` to track modification of runtime classes
  Bump version
  Optimize NameExpression compilation
  Fix typo in enum twig doc functions
  Remove dead method in ModuleNode
  Bump version
  Prepare the 3.18.0 release
  Add support for `Twig\Markup`
  Fix unary operator precedence change
  Replace Twigfiddle by the new Twig playground
  Fix MacroNode $name argument can be overridden
  Ignore exceptions from undefined handlers when using the guard tag
  [Doc] Update the docs about attribute() function
  Fix doc
  ...
2025-01-10 08:41:31 +01:00
Baptiste 3889bc7b18 Fix typo in enum twig doc functions 2025-01-02 09:42:18 +01:00
Javier Eguiluz 84daad9a27 [Doc] Update the docs about attribute() function 2024-12-19 08:39:55 +01:00
Pepperoni1337 03792f643f Use .html.twig file extension in documentation instead of .html 2024-12-18 11:01:27 +01:00
seb-jean 99ea35e1e8 Change = to : for named arguments 2024-12-14 19:49:00 +01:00
Fabien Potencier 6f996fc214 Merge branch '3.x' into 4.x
* 3.x:
  Simplify enum usage in docs
  Forbid adding Nodes to EmptyNode
  Add phpstan analysis
  Fix the intl-extra tests
  Fix the string-extra tests when running with older symfony/string
  Fix the exception message to match the expected one for not ready nodes
  Add missing import
  Add BC break note in CHANGELOG for 3.15
  Fix CHANGELOG
  Update CHANGELOG
  Bump version
  Prepare the 3.15.0 release
2024-11-22 10:06:29 +01:00