Commit Graph

6099 Commits

Author SHA1 Message Date
Fabien Potencier fea9dfc028 Merge branch '2.x' into 3.x
* 2.x:
  Reorganize some information
  Add `Twig Language Server` and `Modern Twig` extension to docs
2023-08-02 10:55:38 +02:00
Fabien Potencier ef655c4d6e Reorganize some information 2023-08-02 10:55:33 +02:00
Fabien Potencier 93c664f4c9 minor #3868 Add Twig Language Server and Modern Twig extension to docs (kaermorchen)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

Add `Twig Language Server` and `Modern Twig` extension to docs

Commits
-------

a949600c Add `Twig Language Server` and `Modern Twig` extension to docs
2023-08-02 10:53:44 +02:00
Stanislav Romanov a949600c4b Add Twig Language Server and Modern Twig extension to docs 2023-08-02 10:53:41 +02:00
Fabien Potencier fa5f1d4c2e Merge branch '2.x' into 3.x
* 2.x:
  Bump min deps
2023-07-29 17:34:56 +02:00
Fabien Potencier b60ed3e085 minor #3865 Bump min deps (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Bump min deps

Commits
-------

c12990f9 Bump min deps
2023-07-29 17:33:29 +02:00
Fabien Potencier c12990f9e7 Bump min deps 2023-07-29 13:31:08 +02:00
Fabien Potencier 2e0286630e Merge branch '2.x' into 3.x
* 2.x:
  Fix BC break
  Update Drupal version in tests
  Fix code
  Bump PHP version used by Drupal tests
  add return type for Symfony 7 compatibility
2023-07-29 13:21:17 +02:00
Fabien Potencier 244d5de454 Fix BC break 2023-07-29 13:21:11 +02:00
Fabien Potencier e3804ae8aa bug #3864 Bump PHP version used by Drupal tests (fabpot)
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Bump PHP version used by Drupal tests

Commits
-------

da38e858 Update Drupal version in tests
64543c3c Fix code
4c4f73ca Bump PHP version used by Drupal tests
2023-07-29 13:19:42 +02:00
Fabien Potencier da38e858e3 Update Drupal version in tests 2023-07-28 12:21:15 +02:00
Fabien Potencier 64543c3c49 Fix code 2023-07-28 12:18:03 +02:00
Fabien Potencier 4c4f73ca70 Bump PHP version used by Drupal tests 2023-07-28 11:59:50 +02:00
Fabien Potencier ae105b385b minor #3862 Fix callable phpdoc for twig elements (VincentLanglet)
This PR was merged into the 3.x branch.

Discussion
----------

Fix callable phpdoc for twig elements

Hi `@fabpot`
I made a stupid mistake in https://github.com/twigphp/Twig/pull/3856

The correct phpdoc is `array{class-string, string}` and not `array<class-string, string>`.

Code is used this way
```
$compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1]));
```
which means the key 0 is a class string, and the key 1 is a string.

`array{class-string, string}` is same as `array{0: class-string, 1: string}`
`array<class-string, string>` is saying all the keys are class-string, and values are string.

Commits
-------

1b58589d Fix callable phpdoc
2023-07-28 11:58:50 +02:00
Fabien Potencier 91a42f7f22 minor #3863 add return type for Symfony 7 compatibility (xabbuh)
This PR was merged into the 2.x branch.

Discussion
----------

add return type for Symfony 7 compatibility

Commits
-------

fac08ec7 add return type for Symfony 7 compatibility
2023-07-28 11:54:15 +02:00
Christian Flothmann fac08ec7d3 add return type for Symfony 7 compatibility 2023-07-27 11:30:49 +02:00
Vincent Langlet 1b58589d56 Fix callable phpdoc 2023-07-27 10:17:36 +02:00
Fabien Potencier 9a9580fff9 Bump version 2023-07-26 09:17:41 +02:00
Fabien Potencier 5cf942bbab Prepare the 3.7.0 release v3.7.0 2023-07-26 09:16:09 +02:00
Fabien Potencier 07c4b11399 Update CHANGELOG 2023-07-26 09:15:15 +02:00
Nicolas Grekas 4ef92bf092 minor #3860 Fix spread operator implementation (nicolas-grekas)
This PR was merged into the 3.x branch.

Discussion
----------

Fix spread operator implementation

#3839 is too invasive, leading to failures like https://github.com/symfony/symfony/actions/runs/5612246672/jobs/10269741115

Commits
-------

75efa5e1 Fix spread operator implementation
2023-07-20 18:36:01 +02:00
Nicolas Grekas 75efa5e1ba Fix spread operator implementation 2023-07-20 18:11:45 +02:00
Fabien Potencier 09177a7006 feature #3839 Adding support for the ...spread operator on arrays and hashes (weaverryan)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Adding support for the ...spread operator on arrays and hashes

Hi!

Long time user, first time contributor of a real future. I hope I didn't miss anything - but this seemed quite straightforward in the end.

Notes:
* In PHP 7.3 or lower, using the spread operator will result in a Twig syntax error.
* In 8.0 or lower, using the spread operator on a hash will result in a Twig syntax error.

fabbot failures are unrelated, so I'm not touching them.

Cheers!

Commits
-------

ba4fe3ba Adding support for the ...spread operator on arrays and hashes
2023-07-20 16:08:59 +02:00
Ryan Weaver ba4fe3ba34 Adding support for the ...spread operator on arrays and hashes 2023-07-20 16:08:57 +02:00
Fabien Potencier e145d36266 minor #3856 Fix callable phpdoc for twig elements (VincentLanglet)
This PR was merged into the 3.x branch.

Discussion
----------

Fix callable phpdoc for twig elements

Hi `@fabpot`
```
[MyRuntime::class, 'myMethod]
```
is not a valid callable in PHP 8 https://3v4l.org/tWqPs

But this syntax is supported because twig has a special behavior
```
$compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1]));
```

The PHPDoc should be updated in order to reflect the real behavior and solve static analysis errors.
A phpstan discussion can be found here: https://github.com/phpstan/phpstan/discussions/9567

Commits
-------

cd68de5e Fix callable phpdoc for twig elements
2023-07-05 12:13:55 +02:00
Vincent Langlet cd68de5e06 Fix callable phpdoc for twig elements 2023-07-05 11:30:59 +02:00
Fabien Potencier 58f7b22081 minor #3854 add extra example to slice filter (expedition-robin-martijn)
This PR was merged into the 3.x branch.

Discussion
----------

add extra example to slice filter

Commits
-------

0170dc3c add extra example to slice filter
2023-06-30 08:17:55 +02:00
Robin Martijn 0170dc3cd7 add extra example to slice filter 2023-06-28 14:29:30 +02:00
Fabien Potencier 2fa539bfe7 Merge branch '2.x' into 3.x
* 2.x:
  Mention where named arguments are supported
  Bump version
2023-06-12 08:17:02 +02:00
Fabien Potencier 7f4f55575b minor #3849 Mention where named arguments are supported (mpdude)
This PR was merged into the 2.x branch.

Discussion
----------

Mention where named arguments are supported

This follows up on #929. I tend to forget this detail, so it confuses me over and over again.

Commits
-------

ef9d7855 Mention where named arguments are supported
2023-06-12 08:16:05 +02:00
Fabien Potencier df75bfef37 Bump version to 3.6.2 2023-06-09 16:03:53 +02:00
Matthias Pigulla ef9d785518 Mention where named arguments are supported 2023-06-09 11:18:52 +00:00
Fabien Potencier 7e7d5839d4 Prepare the 3.6.1 release v3.6.1 2023-06-08 14:52:13 +02:00
Fabien Potencier 69d58e5705 Update CHANGELOG 2023-06-08 14:51:43 +02:00
Fabien Potencier 833e51ea35 minor #3840 Suppress native return type deprecation msg (PhilETaylor)
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
2023-05-06 19:15:54 +02:00
Phil E. Taylor 72d6f20556 suppress native return type deprecation msg 2023-05-06 12:11:46 +01:00
Fabien Potencier 51ccbdc983 Bump version 2023-05-03 21:08:52 +02:00
Fabien Potencier 3fd3645601 Bump version 2023-05-03 21:08:22 +02:00
Fabien Potencier 106c170d08 Prepare the 3.6.0 release v3.6.0 2023-05-03 21:06:57 +02:00
Fabien Potencier 0911e40675 Update CHANGELOG 2023-05-03 21:06:32 +02:00
Fabien Potencier 125532f572 Merge branch '2.x' into 3.x
* 2.x:
  Prepare the 2.15.5 release
  Update CHANGELOG
2023-05-03 19:50:57 +02:00
Fabien Potencier fc02a6af3e Prepare the 2.15.5 release v2.15.5 2023-05-03 19:49:41 +02:00
Fabien Potencier 17bf0637d9 Update CHANGELOG 2023-05-03 19:49:13 +02:00
Fabien Potencier e2d668551b Merge branch '2.x' into 3.x
* 2.x:
  Making the Lexer initialize itself lazily, to avoid loading the extension set early
2023-05-03 19:47:35 +02:00
Fabien Potencier 72230e28d3 bug #3837 Making the Lexer initialize itself lazily, to avoid loading the extension set early (weaverryan)
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
2023-05-03 19:47:15 +02:00
Ryan Weaver 2f7e868017 Making the Lexer initialize itself lazily, to avoid loading the extension set early 2023-05-03 19:47:11 +02:00
Fabien Potencier f5ee1b6815 minor #3834 Put example all on one line (edent)
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
2023-04-25 14:06:28 +02:00
Terence Eden 9bb05acae4 Put example all on one line
Fixes #3833
2023-04-24 22:26:49 +01:00
Fabien Potencier 1812ca1ade bug #3832 return annotation to suppress deprecation warning (PhilETaylor)
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
2023-04-14 13:18:53 +02:00
Phil E. Taylor b7a8ebbe6f return annotation to suppress deprecation warning 2023-04-14 12:03:02 +01:00