Commit Graph

4232 Commits

Author SHA1 Message Date
Fabien Potencier c91c625f01 Merge branch '1.x' into 2.x
* 1.x:
  simplified code
  use load() instead of loadTemplate() in tests
  added the possibility to pass a TemplateWrapper to Twig\Environment::load()
2019-03-11 19:58:03 +01:00
Fabien Potencier bebc7a9d5b feature #2882 Environment class cleanup 1.x (fabpot)
This PR was squashed before being merged into the 1.x branch (closes #2882).

Discussion
----------

Environment class cleanup 1.x

Commits
-------

8ab10798 simplified code
e2103c87 use load() instead of loadTemplate() in tests
c82d7dca added the possibility to pass a TemplateWrapper to Twig\Environment::load()
2019-03-11 19:54:21 +01:00
Fabien Potencier 8ab1079842 simplified code 2019-03-11 19:19:06 +01:00
Fabien Potencier e2103c87ae use load() instead of loadTemplate() in tests 2019-03-11 19:18:00 +01:00
Fabien Potencier c82d7dcaab added the possibility to pass a TemplateWrapper to Twig\Environment::load() 2019-03-11 19:07:45 +01:00
Fabien Potencier d7ddefe6a2 fixed CS 2019-03-11 19:04:50 +01:00
Fabien Potencier 43f789b55c minor #2880 Simplify some code (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Simplify some code

Commits
-------

d46e6d4a simplified some code
2019-03-11 17:35:35 +01:00
Fabien Potencier d46e6d4a39 simplified some code 2019-03-11 16:53:41 +01:00
Fabien Potencier 2861b40965 Merge branch '1.x' into 2.x
* 1.x:
  removed -2 magic number
  tried to avoid guessing template info on errors
2019-03-11 16:18:55 +01:00
Fabien Potencier eb89971925 minor #2879 Try to avoid guessing template info on errors (fabpot)
This PR was squashed before being merged into the 1.x branch (closes #2879).

Discussion
----------

Try to avoid guessing template info on errors

Right now, for syntax errors triggered in a Node, we guess the template line and source, but we then try to set the information in the Parser class. This PR avoids the guessing as it's slow.

Commits
-------

69c0539c removed -2 magic number
2389faea tried to avoid guessing template info on errors
2019-03-11 16:18:06 +01:00
Fabien Potencier 69c0539cc6 removed -2 magic number 2019-03-11 16:11:54 +01:00
Fabien Potencier 2389faeae3 tried to avoid guessing template info on errors 2019-03-11 16:04:11 +01:00
Fabien Potencier 4c3aaa5611 removed obsolete docs 2019-03-11 14:00:15 +01:00
Fabien Potencier dd96b16347 Merge branch '1.x' into 2.x
* 1.x:
  tweaked docs for macro
  document support for defining default argument values in the macro tag
2019-03-11 14:00:00 +01:00
Fabien Potencier 04408cda3a tweaked docs for macro 2019-03-11 13:59:54 +01:00
Fabien Potencier 1da95371d1 minor #2870 document support for defining default argument values in the macro tag (olets)
This PR was merged into the 1.x branch.

Discussion
----------

document support for defining default argument values in the macro tag

The `macro` tag documentation reads

> Macros differ from native PHP functions in a few ways:
> - Default argument values are defined by using the default filter in the macro body

and provides the example

```twig
{% macro input(name, value, type, size) %}
    <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
{% endmacro %}
```

The implication is that native PHP function-like default argument value definition is not supported.

v1.12 added support for

```twig
{% macro input1(name, value, type = 'text', size = 20) %}
    <input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}" />
{% endmacro %}
```

This updates the documentation to cover both ways of defining default argument values.

Commits
-------

40c7553a document support for defining default argument values in the macro tag
2019-03-11 13:55:14 +01:00
Fabien Potencier 0ad866d513 Merge branch '1.x' into 2.x
* 1.x:
  do not check sandbox for __toString if method does not exist on object
  tweaked sandbox generated code
  fixed indentation of the compiled template
2019-03-11 12:07:26 +01:00
Fabien Potencier b1894d3df2 do not check sandbox for __toString if method does not exist on object 2019-03-11 12:03:25 +01:00
Fabien Potencier c36cf0db30 minor #2877 Tweak sandbox generated code (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Tweak sandbox generated code

Commits
-------

cbb8f6ed tweaked sandbox generated code
2019-03-11 11:49:33 +01:00
Fabien Potencier cbb8f6edc1 tweaked sandbox generated code 2019-03-11 08:53:51 +01:00
Fabien Potencier af6bdc4b12 fixed indentation of the compiled template 2019-03-11 07:48:38 +01:00
Fabien Potencier 906333bf8e minor #2875 Fix deprecation notes (nicolas-grekas)
This PR was merged into the 2.x branch.

Discussion
----------

Fix deprecation notes

`ExpressionParser` still uses `since version [...]` because the message is not only about Twig: any package providing extensions can trigger it.

Commits
-------

0f8d66be Fix deprecation notes
2019-03-10 12:28:16 +01:00
Fabien Potencier 2f1362c737 minor #2874 Remove runtime deprecation that prevent smooth update (nicolas-grekas)
This PR was merged into the 2.x branch.

Discussion
----------

Remove runtime deprecation that prevent smooth update

This deprecation is already triggered when a class that implements `InitRuntimeInterface` is loaded.
This runtime deprecation prevents creating a continuous upgrade path.

Commits
-------

8f9fe276 Remove runtime deprecation that prevent smooth update
2019-03-10 12:27:35 +01:00
Nicolas Grekas 0f8d66be38 Fix deprecation notes 2019-03-10 11:48:42 +01:00
Nicolas Grekas 8f9fe27622 Remove runtime deprecation that prevent smooth update 2019-03-10 11:40:58 +01:00
Fabien Potencier 456175d85b updated CHANGELOG 2019-03-10 10:47:33 +01:00
Fabien Potencier b631c7509f Merge branch '1.x' into 2.x
* 1.x:
  improved the performance of the sandbox
2019-03-10 10:47:02 +01:00
Fabien Potencier 7ce5261621 minor #2873 Improve the performance of the sandbox (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Improve the performance of the sandbox

Commits
-------

5c661869 improved the performance of the sandbox
2019-03-10 10:43:19 +01:00
Fabien Potencier 5c66186979 improved the performance of the sandbox 2019-03-10 10:34:31 +01:00
Fabien Potencier f3941f0662 fixed some deprecation messages 2019-03-10 10:19:10 +01:00
Fabien Potencier 432f295baa added a deprecation notice when using the spaceless tag 2019-03-10 09:05:07 +01:00
Fabien Potencier a65a807afa Merge branch '1.x' into 2.x
* 1.x:
  added a note about the performance of the spaceless filter
2019-03-10 09:00:42 +01:00
Fabien Potencier 68bbf5eb85 added a note about the performance of the spaceless filter 2019-03-10 08:59:57 +01:00
Henry Bley-Vroman 40c7553a69 document support for defining default argument values in the macro tag 2019-03-08 09:01:54 -05:00
Fabien Potencier fbb79d7752 removed dead code 2019-03-07 14:29:23 +01:00
Fabien Potencier 64f7c02431 deprecated the spaceless tag 2019-03-07 11:02:32 +01:00
Fabien Potencier 65ea4c5296 Merge branch '1.x' into 2.x
* 1.x:
  Revert "re-implemented the spaceless tag to reuse the filter tag logic"
  fixed CS
  re-implemented the spaceless tag to reuse the filter tag logic
  added a spaceless filter
  removed unneeded usage of spaceless in tests
2019-03-07 10:59:18 +01:00
Fabien Potencier 83efde6a4d Revert "re-implemented the spaceless tag to reuse the filter tag logic"
This reverts commit 743767bce8.
2019-03-07 10:58:47 +01:00
Fabien Potencier 9956811bbc feature #2872 Add spaceless filter (fabpot)
This PR was squashed before being merged into the 1.x branch (closes #2872).

Discussion
----------

Add spaceless filter

Commits
-------

a22a5c4b fixed CS
743767bc re-implemented the spaceless tag to reuse the filter tag logic
b823898e added a spaceless filter
1ba79416 removed unneeded usage of spaceless in tests
2019-03-07 10:24:21 +01:00
Fabien Potencier a22a5c4bd1 fixed CS 2019-03-07 10:20:57 +01:00
Fabien Potencier 743767bce8 re-implemented the spaceless tag to reuse the filter tag logic 2019-03-07 10:18:51 +01:00
Fabien Potencier b823898ee1 added a spaceless filter 2019-03-07 10:18:51 +01:00
Fabien Potencier 1ba7941656 removed unneeded usage of spaceless in tests 2019-03-07 08:03:42 +01:00
Fabien Potencier 29a2e18e14 Merge branch '1.x' into 2.x
* 1.x:
  fixed some issues
2019-03-06 22:09:35 +01:00
Fabien Potencier 5d79776175 bug #2871 Fix some issues (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Fix some issues

Commits
-------

c58fa840 fixed some issues
2019-03-06 22:09:17 +01:00
Fabien Potencier c58fa84054 fixed some issues 2019-03-06 22:08:00 +01:00
Fabien Potencier 8254d07064 removed @internal tag on Twig\Template as the whole class is marked as internal 2019-03-06 18:46:56 +01:00
Fabien Potencier 6ead78b202 Merge branch '1.x' into 2.x
* 1.x:
  removed @internal tag on Twig\Template as the whole class is marked as internal
2019-03-06 18:44:06 +01:00
Fabien Potencier 586d5cb411 removed @internal tag on Twig\Template as the whole class is marked as internal 2019-03-06 18:43:55 +01:00
Fabien Potencier 1705b7a233 Merge branch '1.x' into 2.x
* 1.x:
  removed some unneded phpdocs
2019-03-06 18:22:53 +01:00