37 Commits

Author SHA1 Message Date
Fabien Potencier c0504b90c5 Handle single-node child template bodies in cleanup 2026-06-11 07:44:00 +02:00
Fabien Potencier c12100525e Introduce a CorrectnessNodeVisitor to validate that templates are semantically correct 2026-06-11 07:43:33 +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
itsalmostchristmas 2b4aa4458a Make embeds deterministic 2026-05-16 09:48:23 +01:00
Fabien Potencier 54d5c004b4 Deprecate passing a non-AbstractExpression node to Parser::setParent() 2026-02-22 15:28:59 +01:00
Fabien Potencier 861215c507 Fix CS 2026-02-07 09:07:38 +01:00
Fabien Potencier 8391928896 Fix deprecations 2026-01-12 09:52:14 +01:00
Nicolas Grekas 85a4817128 CS fixes 2025-07-29 10:07:07 +02:00
Fabien Potencier e7e72ff090 Deprecate not passing a Source to TokenStream 2024-11-24 19:41:42 +01:00
Fabien Potencier 66658a3c1d Check reserved names in TempNameExpression 2024-10-14 19:42:47 +02:00
Fabien Potencier 8b278986b8 Deprecate using Node directly, introduce EmptyNode and Nodes 2024-09-27 07:42:41 +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
Alexander M. Turek 6ddb76bb76 Make data providers static 2024-09-03 16:32:00 +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 f9f7b7959f feature #4010 Mark implicit macro argument default values as such with an attribute in AST (drjayvee)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Mark implicit macro argument default values as such with an attribute in AST

This change causes no difference to compiled templates or to macro argument semantics.

Consider the following macro:
```twig
{% macro marco(po, lo = null) %}{% endmacro %}
```

With this change, the `ConstantExpression` for argument `po` will have an attribute `is_implicit`, whose value will be `true`. (Note that `lo` will not have that attribute.)

This allows node visitors to distinguish between arguments that do and those that do not have explicit default values even if the value is `null`.

This is useful for [static code analysis](https://github.com/twigphp/Twig/issues/4003).

For example, a static analysis tool might consider arguments with no explicit default value as non-optional.

Commits
-------

e83a8028 Mark implicit macro argument default values as such with an attribute in AST
2024-08-27 13:21:41 +02:00
Jeroen Versteeg e83a8028f0 Mark implicit macro argument default values as such with an attribute in AST 2024-08-27 13:21:06 +02:00
Fabien Potencier 9e6c4a6ac1 Deprecate some internal methods from Parser 2024-08-26 09:24:03 +02:00
Fabien Potencier e4e95f5b86 Replace template loader mocks by ArrayLoader 2024-07-24 08:27:23 +02:00
Fabien Potencier 5193653ecb Fix CS 2023-10-08 09:05:22 +02:00
Fabien Potencier 09760aa689 Merge branch '2.x' into 3.x
* 2.x:
  Removed unneeded ext refs
2022-06-02 20:36:43 +02:00
Fabien Potencier 3aba62185d Removed unneeded ext refs 2022-06-02 20:36:38 +02:00
Fabien Potencier 879fb0adcc Merge branch '2.x' into 3.x
* 2.x:
  removed usage of getmockBuilder() when not needed
  removed usage of getmockBuilder() when not needed
2019-08-08 13:35:34 +02:00
Fabien Potencier 656c295ed9 Merge branch '1.x' into 2.x
* 1.x:
  removed usage of getmockBuilder() when not needed
2019-08-08 13:33:07 +02:00
Fabien Potencier 5861a539e4 removed usage of getmockBuilder() when not needed 2019-08-08 11:59:51 +02:00
Fabien Potencier 5e3ede955b Merge branch '2.x' into 3.x
* 2.x:
  Fix PHPUnit deprecations
  Update to PhpUnitBridge and fix deprecations
2019-08-08 11:05:13 +02:00
Fabien Potencier 5ebcecf24b Fix PHPUnit deprecations 2019-08-08 11:03:05 +02:00
Fabien Potencier c829dafd75 Merge branch '1.x' into 2.x
* 1.x:
  Update to PhpUnitBridge and fix deprecations
2019-08-08 10:19:01 +02:00
Jérémy Derussé b776e41f5a Update to PhpUnitBridge and fix deprecations 2019-08-08 09:39:49 +02:00
Fabien Potencier 83e404ee35 Merge branch '2.x' into 3.x
* 2.x:
  fixed docs
  simplified .travis.yml
  fixed CHANGELOG
  Upgrade minimal version of php
  Restore tests on PHP 5.4
  fixed CS
2019-08-08 00:48:53 +02:00
Fabien Potencier 336d69c166 fixed CS 2019-08-07 20:54:50 +02:00
Fabien Potencier af6412effe Merge branch '2.x' into 3.x
* 2.x:
  fixed tests for PHP 7.4
2019-06-30 15:36:41 +02:00
Fabien Potencier f1b1b87912 Merge branch '1.x' into 2.x
* 1.x:
  fixed tests for PHP 7.4
2019-06-30 15:36:34 +02:00
Fabien Potencier 0947777bc6 fixed tests for PHP 7.4 2019-06-30 15:21:28 +02:00
Fabien Potencier 6823b64cad moved test under tests/ 2019-06-30 14:56:12 +02:00
Fabien Potencier 1e3bb75010 moved test under tests/ 2019-06-30 14:51:54 +02:00
Fabien Potencier 22a1317249 moved tests under tests/ 2019-06-30 14:48:27 +02:00