Commit Graph

5798 Commits

Author SHA1 Message Date
Fabien Potencier 3cefebac2b feature #3559 Allow CommonMark extensions to easily be added (kbond)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Allow CommonMark extensions to easily be added

1. I discovered that commonmark 2 works just fine with `markdown-extra` so I added to the `require-dev` of `markdown-extra`'s `composer.json`
2. Added `LeagueMarkdownFactory` to `markdown-extra` as discussed in #3558
3. In `twig-extra-bundle`, if commonmark (and the above factory) is available, wire up the factory with extensions added via the `twig.markdown.league_extension` DI tag

If this PR would be acceptable, I can add some tests.

(closes #3558)

Commits
-------

4b86f5ef Allow CommonMark extensions to easily be added
2022-01-02 16:32:49 +01:00
Kevin Bond 4b86f5efdc Allow CommonMark extensions to easily be added 2022-01-02 16:32:46 +01:00
Fabien Potencier ec1e739ef9 minor #3541 Implement template annotation for getExtension (mitelg)
This PR was merged into the 3.x branch.

Discussion
----------

Implement template annotation for `getExtension`

Hello there 🙂  👋

my first PR here 😉

This change would help to improve static analysis with tools like PHPStan and Psalm.

Commits
-------

110871d1 Implement template annotation for `getExtension` and `getRuntime`
2022-01-02 16:29:57 +01:00
Fabien Potencier 5aad8295af Merge branch '2.x' into 3.x
* 2.x:
  Bump license year
  Typo fix : "flexiblity" ➤ "flexibility"
  allow translation-contracts:^3
2022-01-02 11:02:25 +01:00
Fabien Potencier ce97157b43 Bump license year 2022-01-02 11:02:19 +01:00
Fabien Potencier 8b989ebc8a bug #3608 Allow symfony/translation-contracts:^3 (michaljusiega)
This PR was merged into the 2.x branch.

Discussion
----------

Allow symfony/translation-contracts:^3

However,
I am just wondering why this dependency is required since it's not used anywhere in `twig/string-extra`? Or I am wrong ?

Closing https://github.com/twigphp/Twig/issues/3607

Commits
-------

0c1e4edc allow translation-contracts:^3
2021-12-26 18:56:12 +01:00
Fabien Potencier fa678e9244 minor #3611 Typo fix : "flexiblity" ➤ "flexibility" (Levure)
This PR was merged into the 2.x branch.

Discussion
----------

Typo fix : "flexiblity" ➤ "flexibility"

Commits
-------

ca1e79fc Typo fix : "flexiblity" ➤ "flexibility"
2021-12-26 18:49:51 +01:00
Bruno Baguette ca1e79fcec Typo fix : "flexiblity" ➤ "flexibility" 2021-12-26 18:41:09 +01:00
Michał Jusięga 0c1e4edc8b allow translation-contracts:^3 2021-12-22 17:41:26 +01:00
Fabien Potencier dd6c50835d Merge branch '2.x' into 3.x
* 2.x:
  Remove unneeded coments
  Optimize Environment::resolveTemplate() to be much faster when template overrides do not exist
2021-12-17 08:49:53 -08:00
Fabien Potencier 3284859a1b Remove unneeded coments 2021-12-17 08:44:00 -08:00
Fabien Potencier 4d46ed3ac3 minor #3596 Optimize Environment::resolveTemplate() to be much faster when template overrides do not exist (mahagr)
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Optimize Environment::resolveTemplate() to be much faster when template overrides do not exist

Fixes partially #3595.

You can test this by adding an object into the context which implements `__debugInfo()` with a counter in it. Make a template with

```twig
{% include ['missing_template1', 'missing_template2', 'missing_template3', 'missing_template4', 'missing_template5'] %}
```

And check how many times an exception was thrown by reading the counter. The issue gets exponentially worse if you have nested templates with overrides in each of them.

Commits
-------

695423e1 Optimize Environment::resolveTemplate() to be much faster when template overrides do not exist
2021-12-17 08:43:16 -08:00
Matias Griese 695423e14e Optimize Environment::resolveTemplate() to be much faster when template overrides do not exist 2021-12-17 08:43:05 -08:00
Fabien Potencier d97690ff37 Merge branch '2.x' into 3.x
* 2.x:
  Use faster hash algorithm (xxh128) on PHP 8.1
2021-12-16 11:54:25 -08:00
Fabien Potencier 9f3798bafd minor #3588 Use faster hash algorithm (xxh128) on PHP 8.1+ (GromNaN)
This PR was merged into the 2.x branch.

Discussion
----------

Use faster hash algorithm (xxh128) on PHP 8.1+

Twig uses the `hash` function at runtime to convert template paths class names, each time a template is loaded. In a large project with a high granularity of templates (hundreds of `include` per page), this can become the most time consuming function as reported by Blackfire:
<img src="https://user-images.githubusercontent.com/400034/140626949-c4876b7d-c91c-4e07-b2f4-8ebbcaa72f61.png" width="220">

To optimise this use-case, [PHP 8.1 supports the xxHash hash algorithms](https://php.watch/versions/8.1/xxHash). `xxh128` is 60x faster that `sha256` according to the [benchmarks](https://php.watch/articles/php-hash-benchmark), and guarantee a very [low risk of collision](http://cyan4973.github.io/xxHash/).

I'm not able to test with PHP 8.1 for now. Before going further I would like to validate performance impact on a large list of file names.

Commits
-------

4fcc6b1c Use faster hash algorithm (xxh128) on PHP 8.1
2021-12-16 11:53:56 -08:00
Jérôme TAMARELLE 4fcc6b1c47 Use faster hash algorithm (xxh128) on PHP 8.1 2021-12-15 06:29:16 +01:00
Fabien Potencier 63b3ddd11a Merge branch '2.x' into 3.x
* 2.x:
  Hashing is not necessary to generate unique variable names during compilation
2021-12-14 15:28:12 -08:00
Fabien Potencier 2117e4b1bc minor #3601 Hashing is not necessary to generate unique variable names during compilation (GromNaN)
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Hashing is not necessary to generate unique variable names during compilation

Trying to optimize calls to `hash` function (#3588), I found that some calls are made during compilation that are not necessary at all.

According to the last commits on this functions (57ff88255e & 6ab5fe9b8f), the internal variable names must be unique and deterministic. Using a simple sequence is enough.

This avoid CPU cycles during compilation. Which should not have any impact on production; but still interesting for dev&test.

Commits
-------

ba2b4e6d Hashing is not necessary to generate unique variable names during compilation
2021-12-14 15:27:12 -08:00
Jérôme Tamarelle ba2b4e6dfe Hashing is not necessary to generate unique variable names during compilation 2021-12-14 15:26:59 -08:00
Fabien Potencier 31629a69f7 Merge branch '2.x' into 3.x
* 2.x:
  Fix a typo in api.rst
  Fix a typo advanced.rst
2021-11-29 09:51:28 +01:00
Fabien Potencier a41a6cce62 minor #3593 Fix a typo in api.rst (fishmandev)
This PR was merged into the 2.x branch.

Discussion
----------

Fix a typo in api.rst

Fix a typo

Commits
-------

68d59ab8 Fix a typo in api.rst
2021-11-29 09:43:57 +01:00
Dmitriy Fishman 68d59ab8c4 Fix a typo in api.rst 2021-11-29 07:20:05 +02:00
Fabien Potencier e2a0b873cc minor #3592 Fix a typo advanced.rst (fishmandev)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

Fix a typo advanced.rst

Fix a typo

Commits
-------

cd24fb57 Fix a typo advanced.rst
2021-11-28 13:30:11 +01:00
Dmitriy Fishman cd24fb57bc Fix a typo advanced.rst 2021-11-28 13:30:08 +01:00
Fabien Potencier 5785185018 Bump version 2021-11-25 14:49:08 +01:00
Fabien Potencier 65cb6f0b95 Prepare the 3.3.4 release v3.3.4 2021-11-25 14:46:55 +01:00
Fabien Potencier 324bad1bb2 Update CHANGELOG 2021-11-25 14:46:40 +01:00
Fabien Potencier 301a8149ac Remove changelogs from 2.x 2021-11-25 14:45:56 +01:00
Fabien Potencier 8e58a9f440 Merge branch '2.x' into 3.x
* 2.x:
  Bump version
  Prepare the 2.14.8 release
  Update CHANGELOG
  Remove changelogs from 1.x
  Prepare the last release for the 1.x series
2021-11-25 14:45:34 +01:00
Fabien Potencier 527c9e05c9 Bump version 2021-11-25 14:44:38 +01:00
Fabien Potencier 06b450a232 Prepare the 2.14.8 release v2.14.8 2021-11-25 14:38:06 +01:00
Fabien Potencier b4ac5878c2 Update CHANGELOG 2021-11-25 14:37:52 +01:00
Fabien Potencier c9022c06ed Remove changelogs from 1.x 2021-11-25 14:36:14 +01:00
Fabien Potencier 91ba2e5361 Merge branch '1.x' into 2.x
* 1.x:
  Prepare the last release for the 1.x series
2021-11-25 14:35:54 +01:00
Fabien Potencier ae39480f01 Prepare the last release for the 1.x series v1.44.6 2021-11-25 14:31:46 +01:00
Fabien Potencier 33ed3b7e33 Merge branch '2.x' into 3.x
* 2.x:
  Upgrade to version 4.4 lts at least
2021-11-13 17:20:21 +01:00
Fabien Potencier a95486f2c6 minor #3587 Upgrade to version 4.4 lts at least (noniagriconomie)
This PR was merged into the 2.x branch.

Discussion
----------

Upgrade to version 4.4 lts at least

Related to https://github.com/twigphp/twig-extra-bundle/pull/4
Friendly ping `@fabpot`
For the `twig/twig` upgrade, it is related to https://packagist.org/packages/twig/twig/advisories?version=2690125

Commits
-------

315e16f5 Upgrade to version 4.4 lts at least
2021-11-13 17:19:35 +01:00
noniagriconomie 315e16f5df Upgrade to version 4.4 lts at least 2021-11-08 13:29:10 +01:00
Fabien Potencier 7cf279d3d6 Merge branch '2.x' into 3.x
* 2.x:
  [TwigExtraBundle] Add the return type information in getConfigTreeBuilder()
2021-11-05 17:53:41 +01:00
Fabien Potencier a34f98ec59 bug #3586 [TwigExtraBundle] Add the return type information in getConfigTreeBuilder() (javiereguiluz)
This PR was merged into the 2.x branch.

Discussion
----------

[TwigExtraBundle] Add the return type information in getConfigTreeBuilder()

Moved from https://github.com/twigphp/twig-extra-bundle/pull/5

-----

This will fix the following deprecation:

```
  1x: Method "Symfony\Component\Config\Definition\ConfigurationInterface::getConfigTreeBuilder()" might add "TreeBuilder" as a native return type declaration in the future. Do the same in implementation "Twig\Extra\TwigExtraBundle\DependencyInjection\Configuration" now to avoid errors or add an explicit `@return` annotation to suppress this message.
    1x in AddUserCommandTest::testCreateUserNonInteractive from App\Tests\Command
```

Commits
-------

26654f65 [TwigExtraBundle] Add the return type information in getConfigTreeBuilder()
2021-11-05 17:53:11 +01:00
Javier Eguiluz 26654f653f [TwigExtraBundle] Add the return type information in getConfigTreeBuilder() 2021-11-05 16:54:01 +01:00
Fabien Potencier d87d6a0b6d Merge branch '2.x' into 3.x
* 2.x:
  Fix emphasis on compiler to bold styling
2021-11-04 18:53:43 +01:00
Fabien Potencier f75db68112 Merge branch '1.x' into 2.x
* 1.x:
  Fix emphasis on compiler to bold styling
2021-11-04 18:53:35 +01:00
Fabien Potencier 7e5ba95dc8 minor #3584 Fix emphasis on compiler to bold styling (jonnyeom)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead.

Discussion
----------

Fix emphasis on compiler to bold styling

This is just so the Lexer, Parser, and Compiler has the same styling

Commits
-------

97ae3c8e Fix emphasis on compiler to bold styling
2021-11-04 18:52:44 +01:00
Jonny Eom 97ae3c8e97 Fix emphasis on compiler to bold styling 2021-11-04 18:52:41 +01:00
Fabien Potencier e8fb1ef29b Merge branch '2.x' into 3.x
* 2.x:
  Remove license info in the README now that Github already displays it
2021-11-03 16:51:12 +01:00
Fabien Potencier 8447e8dcd5 Remove license info in the README now that Github already displays it 2021-11-03 16:48:53 +01:00
Fabien Potencier 3e4b22ce13 minor #3577 Update README.md (noniagriconomie)
This PR was merged into the 3.x branch.

Discussion
----------

Update README.md

Ref https://github.com/twigphp/cache-extra/pull/2
friendly ping `@fabpot`

Commits
-------

9286dacb Update README.md
2021-10-18 10:00:25 +02:00
Antoine Makdessi 9286dacb0b Update README.md 2021-10-18 09:47:52 +02:00
Fabien Potencier b13aa12389 Merge branch '2.x' into 3.x
* 2.x:
  Update .gitattributes to exclude non-dist files
2021-10-04 11:04:31 +02:00