Commit Graph

5400 Commits

Author SHA1 Message Date
Fabien Potencier f9ae0f8237 Merge branch '2.x' into 3.x
* 2.x:
  Bump version
  Bump version
  Tweak docs
  Update CHANGELOG
  Support object init from variable
2020-08-23 14:02:58 +02:00
Fabien Potencier 7c3f4ec8e9 Bump version 2020-08-23 14:01:50 +02:00
Fabien Potencier 77dcff7186 Merge branch '1.x' into 2.x
* 1.x:
  Bump version
  Tweak docs
  Update CHANGELOG
  Support object init from variable
2020-08-23 14:01:18 +02:00
Fabien Potencier c6927de9e7 Bump version 2020-08-23 13:59:06 +02:00
Fabien Potencier 244ef52df6 Tweak docs 2020-08-23 13:58:27 +02:00
Fabien Potencier b0ce4f64ba Update CHANGELOG 2020-08-23 13:56:44 +02:00
Fabien Potencier 6fe2924795 feature #3277 Support object initialisation shortcut {a} == {a:a} from ES2015 (GromNaN)
This PR was submitted for the 3.x branch but it was merged into the 1.x branch instead.

Discussion
----------

Support object initialisation shortcut {a} == {a:a} from ES2015

Object declaration in Twig is very close to the Javascript syntax and is targeting the same profil of developers. In order to provide a smooth developer experience, Twig should implement some new feature of ECMAScript.

Since ECMAScript 2015, a short syntax can be used to declare an object when the key is identical to a defined variable (see [MDN doc](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/Object_initializer))

```js
// Shorthand property names (ES2015)
let a = 'foo', b = 42, c = {};
let o = {a, b, c}
```

This PR adds the same syntax to Twig.
This can be very useful for `include ... with ... only` :
```twig
{% set title = "My title" %}
{% set image = "image.jpg" %}
{{ include "template.twig" with {title, image} only }}
# instead of
{{ include "template.twig" with {title: title, image: image} only }}
```

Commits
-------

133edb36 Support object init from variable
2020-08-23 13:55:00 +02:00
Jérôme TAMARELLE 133edb3696 Support object init from variable
{a} is a shortcut for {a:a}
From ECMAScript 2015 syntax https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/Object_initializer
2020-08-23 13:54:49 +02:00
Fabien Potencier 222d053733 Merge branch '2.x' into 3.x
* 2.x:
  Fix CS
  Fix CS
2020-08-23 13:49:50 +02:00
Fabien Potencier cb3a8a25d0 Fix CS 2020-08-23 13:49:43 +02:00
Fabien Potencier 81612a5c7d Merge branch '1.x' into 2.x
* 1.x:
  Fix CS
2020-08-23 13:49:18 +02:00
Fabien Potencier bde54e11b8 Fix CS 2020-08-23 13:48:32 +02:00
Fabien Potencier ea6ebe9bda Merge branch '2.x' into 3.x
* 2.x:
  Migrate more tests
  Update phpunit config
  Update phpunit assertion
  Fixed Twig\Template check
2020-08-23 13:46:01 +02:00
Fabien Potencier 93390aebd3 Merge branch '1.x' into 2.x
* 1.x:
  Migrate more tests
  Update phpunit config
2020-08-23 13:44:00 +02:00
Fabien Potencier 2c7cad3416 minor #3390 More PHPUnit fixes (fabpot)
This PR was squashed before being merged into the 1.x branch.

Discussion
----------

More PHPUnit fixes

Commits
-------

f787c032 Migrate more tests
ad8d012e Update phpunit config
2020-08-23 13:43:11 +02:00
Fabien Potencier f787c032ab Migrate more tests 2020-08-23 12:47:51 +02:00
Fabien Potencier ad8d012e20 Update phpunit config 2020-08-23 12:46:19 +02:00
Fabien Potencier f7ce885a02 Merge branch '1.x' into 2.x
* 1.x:
  Update phpunit assertion
2020-08-23 12:31:37 +02:00
Fabien Potencier a293147027 minor #3389 Update phpunit assertion (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Update phpunit assertion

Commits
-------

e5882d9f Update phpunit assertion
2020-08-23 12:30:49 +02:00
Fabien Potencier e5882d9fb4 Update phpunit assertion 2020-08-23 12:22:59 +02:00
Fabien Potencier b531196d8c bug #3388 Fixed Twig\Template check (brandonkelly)
This PR was merged into the 2.x branch.

Discussion
----------

Fixed Twig\Template check

Looks like this was missed when the `Twig\Template` class was added, and `Twig_Template` was deprecated + aliased.

Commits
-------

67bff7b7 Fixed Twig\Template check
2020-08-13 16:11:59 +02:00
Brandon Kelly 67bff7b7c9 Fixed Twig\Template check 2020-08-13 06:50:55 -07:00
Fabien Potencier 23fb28296e Bump version to 3.0.6-DEV 2020-08-05 17:14:16 +02:00
Fabien Potencier 9b76b15354 Prepare the 3.0.5 release v3.0.5 2020-08-05 17:13:19 +02:00
Fabien Potencier 02043ee8fa Fix CHANGELOG 2020-08-05 17:12:14 +02:00
Fabien Potencier 9808ba393c Merge branch '2.x' into 3.x
* 2.x:
  Bump version to 2.13.2-DEV
  Prepare the 2.13.1 release
  Update CHANGELOG
  Bump version to 1.43.2-DEV
  Prepare the 1.43.1 release
  Update CHANGELOG
2020-08-05 17:10:53 +02:00
Fabien Potencier 76f8ead7ef Bump version to 2.13.2-DEV 2020-08-05 17:10:06 +02:00
Fabien Potencier 57e9625977 Prepare the 2.13.1 release v2.13.1 2020-08-05 17:09:04 +02:00
Fabien Potencier f48f94a358 Update CHANGELOG 2020-08-05 17:08:12 +02:00
Fabien Potencier bf68fa6d22 Merge branch '1.x' into 2.x
* 1.x:
  Bump version to 1.43.2-DEV
  Prepare the 1.43.1 release
  Update CHANGELOG
2020-08-05 17:08:01 +02:00
Fabien Potencier 4ba9822987 Bump version to 1.43.2-DEV 2020-08-05 17:06:12 +02:00
Fabien Potencier 2311602f6a Prepare the 1.43.1 release v1.43.1 2020-08-05 17:05:05 +02:00
Fabien Potencier 5383d354d3 Update CHANGELOG 2020-08-05 17:00:10 +02:00
Fabien Potencier 0fdf96c389 Merge branch '2.x' into 3.x
* 2.x:
  Add a test
  Fix typo
  Fix compatibility with PHPUnit 10
  Update doc for macro with embed tags
  fix typo in ApplyTokenParser PHP doc
  Fixes #3351
2020-08-05 16:54:08 +02:00
Fabien Potencier 38bd74d03a Merge branch '1.x' into 2.x
* 1.x:
  Add a test
  fix typo in ApplyTokenParser PHP doc
  Fixes #3351
2020-08-05 16:53:59 +02:00
Fabien Potencier 94aa9bf305 Add a test 2020-08-05 16:53:34 +02:00
Fabien Potencier 2d2bd8fb63 minor #3381 Added return and argument type for LoaderInterface (reneroboter)
This PR was merged into the 3.x branch.

Discussion
----------

Added return and argument type for LoaderInterface

@fabpot I have started with my preparation for the Twig Certification. Here I found some missing return and argument type at the DatabaseTwigLoader example. Hopefully I fix everything corrent. I couldn't found a CONTRIBUTING.md or anything else.

Commits
-------

5521e034 Added return and argument type for LoaderInterface
2020-08-04 08:19:16 +02:00
René Backhaus 5521e03471 Added return and argument type for LoaderInterface 2020-08-01 09:02:27 +02:00
Fabien Potencier bf3cc60121 Fix typo 2020-07-29 08:07:51 +02:00
Fabien Potencier 1a95a0bafe minor #3377 Macro not available in embed tags (GromNaN)
This PR was merged into the 2.x branch.

Discussion
----------

Macro not available in embed tags

Macro imported globally in a template via `import` or `from` are not available inside `embed` tags.
This behavior is present since Twig v2.0.0. I think it needs to be documented. Feel free to suggest an other text.

Here is some example :

- If the macro is imported globally, it's not available inside the `embed` tag, we get an error : https://twigfiddle.com/jwtwm3
```twig
{% import 'macro.twig' as macro %}
{% embed 'embed.twig' %}
    {% block content %}
        {{ macro.sayhello('Jérôme') }}
    {% endblock %}
{% endembed %}
```
- Whereas is the macro is imported inside the `embed` tag, it's available in its `block` tags : https://twigfiddle.com/jwtwm3/2
```twig
{% embed 'embed.twig' %}
    {% import 'macro.twig' as macro %}
    {% block content %}
        {{ macro.sayhello('Jérôme') }}
    {% endblock %}
{% endembed %}
```

Commits
-------

be291441 Update doc for macro with embed tags
2020-07-29 08:07:02 +02:00
Fabien Potencier c0ec6c9c01 minor #3378 Fix compatibility with PHPUnit 9 (GromNaN)
This PR was merged into the 2.x branch.

Discussion
----------

Fix compatibility with PHPUnit 9

Commits
-------

9a83f7ed Fix compatibility with PHPUnit 10
2020-07-29 07:50:05 +02:00
Jérôme TAMARELLE 9a83f7edf6 Fix compatibility with PHPUnit 10 2020-07-29 03:03:03 +02:00
Jérôme Tamarelle be291441ea Update doc for macro with embed tags 2020-07-29 02:33:15 +02:00
Fabien Potencier b65facc1c5 minor #3373 fix typo in ApplyTokenParser PHP doc (campino2k)
This PR was submitted for the 3.x branch but it was merged into the 1.x branch instead.

Discussion
----------

fix typo in ApplyTokenParser PHP doc

Typo

Commits
-------

47b5028f fix typo in ApplyTokenParser PHP doc
2020-07-21 13:11:55 +02:00
Chris Jung 47b5028f46 fix typo in ApplyTokenParser PHP doc
Typo
2020-07-21 13:11:49 +02:00
Fabien Potencier cb06013c8d bug #3348 Fixes #3351 (Bozhidar Hristov)
This PR was submitted for the 3.x branch but it was squashed and merged into the 1.x branch instead.

Discussion
----------

Fixes #3351

Sandbox mode is not disabled if syntax error occurs inside {% sandbox %} tag

Fixes #3351

Commits
-------

04658c9f Fixes #3351
2020-07-09 14:43:42 +02:00
Bozhidar Hristov 04658c9f59 Fixes #3351 2020-07-09 14:43:36 +02:00
Fabien Potencier 57ca24c5f3 Merge branch '2.x' into 3.x
* 2.x:
  Fix a regression when not using a space before an operator
2020-07-06 15:35:21 +02:00
Fabien Potencier e063bab1a6 Merge branch '1.x' into 2.x
* 1.x:
  Fix a regression when not using a space before an operator
2020-07-06 15:35:12 +02:00
Fabien Potencier 2ecc15a440 bug #3365 Fix a regression when not using a space before an operator (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Fix a regression when not using a space before an operator

Commits
-------

841906b1 Fix a regression when not using a space before an operator
2020-07-06 15:34:54 +02:00