39 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
Hugo Alliaume 9b18e3757d Extract htmlAttrValue() from html_attr for standalone attribute rendering 2026-08-26 16:46:53 +02:00
Fabien Potencier ea8aadf94d Merge branch '3.x' into 4.x
* 3.x:
  Exempt test files from the void_return rule regardless of the config location
  fix version in deprecation message for tag usage outside of root template
  Fix array access with a Stringable key on ArrayAccess objects using object keys
  Throw a SyntaxError instead of a PHP fatal error when a macro argument is defined twice
  Bump version
  Prepare the 3.28.0 release
  Render backed enums using their backing value in the html_attr function
  Tweak previous merge
  Add documention note about variable scope of override blocks in {% embed ... only %}
  Define the macro at the template root in the cache macro fixture
  Update CHANGELOG
  Fix a PHP 8.5 chr() deprecation when decoding octal string escapes
  Fix Markup truthiness in boolean expressions

# Conflicts:
#	CHANGELOG
#	doc/deprecated.rst
#	src/Environment.php
#	src/Node/Expression/TempNameExpression.php
#	src/Node/IfNode.php
#	src/Node/MacroNode.php
#	src/NodeVisitor/CorrectnessNodeVisitor.php
#	tests/Fixtures/tags/inheritance/extends_in_condition.test
#	tests/Fixtures/tags/inheritance/use_in_condition.test
#	tests/Fixtures/tags/inheritance/use_in_macro.test
#	tests/Fixtures/tags/macro/macro_in_block.test
#	tests/Fixtures/tags/macro/macro_in_condition.test
2026-07-08 21:22:49 +02:00
Fabien Potencier 9323a82eb9 Render backed enums using their backing value in the html_attr function 2026-06-25 08:50:01 +02: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 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 83f264bcd8 Merge branch '3.x' into 4.x
* 3.x:
  Allow Symfony 8 packages in Twig extra packages
  Fix array typehint for $variants in HtmlExtension
2025-11-02 20:03:33 +01:00
Younes ENNAJI 64c87eeaa3 Fix array typehint for $variants in HtmlExtension 2025-10-30 01:26:03 +01:00
Fabien Potencier 151aa4ecda Fix CS 2025-02-14 12:57:03 +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
Nicolas Lemoine 8158dabc17 Add support for Twig\Markup
Co-authored-by: Fabien Potencier <fabien@potencier.org>
2024-12-29 11:29:59 +01:00
Fabien Potencier 82cde4edcb Fix CS 2024-11-30 09:45:07 +01:00
Fabien Potencier 5194101f12 Merge branch '3.x' into 4.x
* 3.x:
  Refactor code
  Add some type hints
  Deprecate using ~ with + or - in an expression without using parentheses to clarify precedence
  Change some type hints to be more precise
  Deprecate not passing AbstractExpression args to most constructor arguments for classes extending AbstractExpression
  Remove obsolete method
  Add support for detecting if an expression had explicit parentheses
  Fix tests
  Unify error messages when a filter expects a mapping/sequence
2024-09-30 22:46:04 +02:00
Fabien Potencier 4e08e3ef5f Fix tests 2024-09-30 08:41:48 +02:00
Fabien Potencier 69f8cf7092 Merge branch '3.x' into 4.x
* 3.x:
  Add missing is_iterable() checks
  Fix tests
  Add quotes on filters/functions in CoreExtension
  Use get_debug_type() everywhere
2024-09-29 18:26:00 +02:00
Fabien Potencier 0da899d911 Use get_debug_type() everywhere 2024-09-29 18:08:29 +02:00
Fabien Potencier 4b671fa38d Fix typo 2024-08-28 22:03:32 +02:00
Fabien Potencier 38082c67b1 Fix CS 2024-08-28 22:02:38 +02:00
Fabien Potencier 15c0adb3ed Merge branch '3.x' into 4.x
* 3.x:
  Fix CS
2024-08-18 19:26:04 +02:00
Fabien Potencier 675cb2d141 Fix CS 2024-08-18 19:25:19 +02:00
Fabien Potencier 9e48502555 Merge branch '3.x' into 4.x
* 3.x:
  Fix html_cva docs
  Fix html_cva docs
  Introduce CVA to html-extra
  Move some methods to static calls
2024-08-18 09:40:33 +02:00
Matheo Daninos e3ac14e1c8 Introduce CVA to html-extra 2024-08-18 09:36:16 +02:00
Fabien Potencier 8b47fc319a Use first class callable syntax 2024-07-14 14:01:33 +02:00
Fabien Potencier 67cb9a06fe Merge branch '3.x' into 4.x
* 3.x:
  Update PHPUnit config
  Optimize sprintf() calls for PHP 8.4
2024-06-21 08:27:27 +02:00
Fabien Potencier b63bde3063 Optimize sprintf() calls for PHP 8.4 2024-06-21 08:16:55 +02:00
Fabien Potencier 51bcd21df0 Merge branch '3.x' into 4.x
* 3.x:
  Fix CS
2024-05-01 16:07:15 +02:00
Fabien Potencier b222be9974 Fix CS 2024-05-01 16:06:53 +02:00
Fabien Potencier 5fdb1ee11a Merge branch '3.x' into 4.x
* 3.x:
  Fix a @return type hint
  Fix CS
  Fix a test
  Fix type
  Simplify sandbox code
  Get rid of weird code
  [html-extra] filter classes
  Fix some inconsistencies
2024-04-30 15:46:54 +02:00
Fabien Potencier 68a826cf61 minor #3969 [html-extra] filter classes (kbond)
This PR was merged into the 3.x branch.

Discussion
----------

[html-extra] filter classes

A small formatting change to avoid double spaces:

```twig
class="{{ html_classes('a', false ? 'b', true ? 'c') }}"

{# before #}
class="a  c"

{# after #}
class="a c"
```

Commits
-------

a517c14f [html-extra] filter classes
2024-04-29 21:43:39 +02:00
Kevin Bond a517c14f19 [html-extra] filter classes 2024-04-29 21:42:05 +02:00
Fabien Potencier ae7e6cc9a3 Merge branch '3.x' into 4.x
* 3.x:
  Fix CS
  Remove redundant "$thing instanceof \Countable" check
  Update PHPUnit schema
  fix TwigExtraBundle tests with Symfony 6.0/6.1
2024-02-10 10:03:27 +01:00
Fabien Potencier f7f11ea410 Fix CS 2024-02-10 09:52:03 +01:00
Fabien Potencier ac423430aa Merge branch '3.x' into 4.x
* 3.x:
  Fix CS
  Move functions for CoreExtension
  Move functions for EscaperExtension
  Move functions for StringLoaderExtension
  Move functions for DebugExtension
  Move functions for MarkdownExtension
  Move functions for InkyExtension
  Move functions for CssInlinerExtension
  Move functions for HtmlExtension
  Deprecate internal extension functions in favor of methods on the extension classes
  Tweak deprecated docs
2023-12-10 20:55:15 +01:00
Fabien Potencier 6a18cda5aa Move functions for HtmlExtension 2023-12-09 18:39:01 +01:00
Fabien Potencier be67e9690f Use str_* when possible 2023-12-09 15:33:38 +01:00
Fabien Potencier cb88e0a68c Merge branch '2.x' into 3.x
* 2.x:
  Move things around
2021-01-01 15:58:18 +01:00
Fabien Potencier 1868918724 Move things around 2021-01-01 15:53:48 +01:00