Commit Graph

3098 Commits

Author SHA1 Message Date
Fabien Potencier ed37fc72e1 minor #2290 Better testing of operators returned by Extension (SpacePossum)
This PR was merged into the 1.x branch.

Discussion
----------

Better testing of operators returned by Extension

Add better testing and docs description about operators when using an extension.

Commits
-------

282df53 Better type description on PHPDoc, better testing of returned value.
2016-12-13 10:48:03 +01:00
Fabien Potencier 4ab33413cc feature #2288 marked some classes as being final (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

marked some classes as being final

Not sure about this one. I'd like some reviews before merging (we might make some other ones final and I might have marked some as final which should not). ping @stof @nicolas-grekas

Commits
-------

e89c712 marked some classes as being final
2016-12-13 10:41:06 +01:00
Fabien Potencier e89c712f58 marked some classes as being final 2016-12-10 08:40:37 +01:00
SpacePossum 282df533de Better type description on PHPDoc, better testing of returned value. 2016-12-09 08:12:45 +01:00
Fabien Potencier e4125e6ef9 feature #2273 Make Twig_Error report real source path when possible (nicolas-grekas)
This PR was merged into the 1.x branch.

Discussion
----------

Make Twig_Error report real source path when possible

To get useful stack traces like this one:
![capture du 2016-11-22 12-16-07](https://cloud.githubusercontent.com/assets/243674/20521829/7cc1fa80-b0ad-11e6-81b6-028e66ac9436.png)

Commits
-------

44f0f9c Make Twig_Error report real source path when possible
2016-12-08 11:31:05 +01:00
Nicolas Grekas 44f0f9cecd Make Twig_Error report real source path when possible 2016-12-08 11:07:42 +01:00
Fabien Potencier b6f28e066e feature #2287 added support for {{ _self }} to provide an upgrade path from 1.x to 2.0 (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

added support for {{ _self }} to provide an upgrade path from 1.x to 2.0

fixes #2284

Commits
-------

8ab764b added support for {{ _self }} to provide an upgrade path from 1.x to 2.0
2016-12-08 09:35:14 +01:00
Fabien Potencier 8ab764b4d3 added support for {{ _self }} to provide an upgrade path from 1.x to 2.0 2016-12-08 08:54:19 +01:00
Fabien Potencier 8ad862b98e simplified code 2016-12-05 10:20:45 +01:00
Fabien Potencier ae9b503b17 updated CHANGELOG 2016-12-05 09:53:08 +01:00
Fabien Potencier 6ab2774002 feature #2279 Deprecate usage of undefined blocks (julienfalque)
This PR was merged into the 1.x branch.

Discussion
----------

Deprecate usage of undefined blocks

Alternative to #2277.

Commits
-------

75d474a Deprecate usage of undefined blocks
2016-12-05 09:49:29 +01:00
Julien Falque 75d474a223 Deprecate usage of undefined blocks 2016-11-26 12:48:23 +01:00
Fabien Potencier 717365d089 feature #2271 Deprecate support for mbstring.func_overload != 0 (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Deprecate support for mbstring.func_overload != 0

see https://wiki.php.net/rfc/deprecations_php_7_2

Commits
-------

6668d47 deprecated support for mbstring.func_overload != 0
2016-11-23 10:59:28 -08:00
Fabien Potencier 6668d475d6 deprecated support for mbstring.func_overload != 0 2016-11-23 10:49:23 -08:00
Fabien Potencier 2436915b46 bumped version to 1.28.3-DEV 2016-11-23 10:45:18 -08:00
Fabien Potencier b22ce0eb07 prepared the 1.28.2 release v1.28.2 2016-11-23 10:41:40 -08:00
Fabien Potencier 62aefc57ac updated CHANGELOG 2016-11-21 17:07:11 -08:00
Fabien Potencier 8778313990 added some tests 2016-11-21 17:05:04 -08:00
Fabien Potencier e7aa8e5448 bug #2272 Fix unconsistent behavior with "get" and "is" (wolfx)
This PR was squashed before being merged into the 1.x branch (closes #2272).

Discussion
----------

Fix unconsistent behavior with "get"  and "is"

Commits
-------

8fb35d5 Fix unconsistent behavior with "get"  and "is"
2016-11-21 17:03:53 -08:00
Cyril PERROT 8fb35d5fd4 Fix unconsistent behavior with "get" and "is" 2016-11-21 17:03:50 -08:00
Fabien Potencier 9fce825115 fixed tests 2016-11-21 16:55:02 -08:00
Fabien Potencier ed6e8972ac fixed message 2016-11-19 11:44:10 -08:00
Fabien Potencier b7e60cf37f minor #2270 improved a deprecation notice (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

improved a deprecation notice

Commits
-------

0595c40 improved a deprecation notice
2016-11-19 11:25:47 -08:00
Fabien Potencier 0595c402d7 improved a deprecation notice 2016-11-19 11:13:58 -08:00
Fabien Potencier 4c9603121d bumped version to 1.28.2-DEV 2016-11-18 21:55:27 -08:00
Fabien Potencier fff80c4a7a prepared the 1.28.1 release v1.28.1 2016-11-18 21:52:49 -08:00
Fabien Potencier f59b33a93e bug #2269 Bugfix: When rendering blocks of other templates, don't pass the local blocks array (derrabus, fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Bugfix: When rendering blocks of other templates, don't pass the local blocks array

This PR fixes symfony/symfony#20556.

When referring to a block of another template from within a template that also has a block with the same name, Twig renders the wrong block.

Commits
-------

8c090a7 added tests for block() when using a template argument
a5526f3 fixed block() is defined call when using a template argument
c04d077 Bugfix: When rendering blocks of other templates, don't pass the local blocks array.
2016-11-18 21:51:10 -08:00
Fabien Potencier 8c090a7cc4 added tests for block() when using a template argument 2016-11-18 15:57:16 -05:00
Fabien Potencier a5526f32fb fixed block() is defined call when using a template argument 2016-11-18 15:51:16 -05:00
Alexander M. Turek c04d077e4f Bugfix: When rendering blocks of other templates, don't pass the local blocks array. 2016-11-18 18:23:01 +01:00
Fabien Potencier a1eb0f5601 minor #2268 fixed doc issues (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

fixed doc issues

Commits
-------

629810c fixed doc issues
2016-11-18 10:09:22 -05:00
Fabien Potencier 629810c91e fixed doc issues 2016-11-18 10:07:48 -05:00
Fabien Potencier 9c9816874d fixed typo in the docs 2016-11-18 09:49:07 -05:00
Fabien Potencier 6806d4fada minor #2263 fix wrong __CLASS__ constant (Marco Dania)
This PR was merged into the 1.x branch.

Discussion
----------

fix wrong __CLASS__ constant

Commits
-------

d816d46 fix wrong __CLASS__ constant
2016-11-18 09:00:50 -05:00
Marco Dania d816d46c42 fix wrong __CLASS__ constant 2016-11-18 11:13:19 +01:00
Fabien Potencier e55069863d bumped version to 1.28.1-DEV 2016-11-17 12:51:52 -05:00
Fabien Potencier 60ae30368f prepared the 1.28.0 release v1.28.0 2016-11-17 12:46:53 -05:00
Fabien Potencier 0a78fa9fa4 bug #2257 fixed render block with template wrapper (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

fixed render block with template wrapper

Commits
-------

159bfec fixed render block with template wrapper
2016-11-17 12:45:20 -05:00
Fabien Potencier bee35de653 minor #2256 1 x cleanups (SpacePossum)
This PR was squashed before being merged into the 1.x branch (closes #2256).

Discussion
----------

1 x cleanups

Commits
-------

2ea7d78 1 x cleanups
2016-11-17 11:06:11 -05:00
SpacePossum 2ea7d78f17 1 x cleanups 2016-11-17 11:06:10 -05:00
Fabien Potencier 159bfec4c9 fixed render block with template wrapper 2016-11-17 10:34:29 -05:00
Fabien Potencier 59522d88b8 feature #2250 Add support for PHP 7 null coalescing operator (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Add support for PHP 7 null coalescing operator

This is just one case where we can "optimize" the ternary operator. PHP 7 also supports more complex expressions that can return `null`. The rule here seems to be that you cannot have more than one level of undefinedness.

So, for instance, if `log` is defined, `log("foo") ?? "NOPE"` works, but `log($a["foo"]) ?? "NOPE"` does not if `$a["foo"]` is not defined. If we want to convert the code to always use `??` when possible, this should probably be implemented in the Optimizer node visitor, not here. But the question is: is it worth it in terms of performance? It cleans up the generated code quite a bit though.

closes #1979

Commits
-------

cfc3931 added support for PHP 7 null coalescing operator
2016-11-17 09:17:22 -05:00
Fabien Potencier cfc3931f6e added support for PHP 7 null coalescing operator 2016-11-17 09:16:42 -05:00
Fabien Potencier 9514ca3272 minor #2255 Simplify power (SpacePossum)
This PR was merged into the 1.x branch.

Discussion
----------

Simplify power

Commits
-------

9307bba Simplify power
2016-11-17 08:15:48 -05:00
SpacePossum 9307bba111 Simplify power 2016-11-16 11:04:17 +01:00
Fabien Potencier 61bf5da0ac fixed phpdocs 2016-11-15 17:01:44 -05:00
Fabien Potencier 4b48d614b5 feature #2236 Expose a way to access template data and methods in a portable way (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Expose a way to access template data and methods in a portable way

`Twig_Template` is an internal class, and most of its methods are marked as being `@internal` as they are not "safe" to use by end users.

But some of its features are interesting like `renderBlock()` which is very useful when rendering emails for instance (see #1873).

This PR tries to address both issues by marking the whole `Twig_Template` class as being internal  and by exposing a new way to safely interact with a template besides the obvious `render()`/`display()` methods via `$twig->load("...")`.

If also add some convenient methods like `hasBlock()` or `getBlocks()` (see ~#1831~ and #1882):

```php
$template = $twig->load('index');

echo $template->render($context);
$template->display($context);

if ($template->hasBlock('name') {
   $template->displayBlock('name', $context);
}

foreach ($template->getBlocks() as $block) {
    echo $template->render($block, $context);
}
```

Commits
-------

d7062f3 exposed a way to access template data and methods in a portable way
2016-11-15 16:12:57 -05:00
Fabien Potencier 08bd6f15a5 feature #2249 Remove optimization as it's not compatible with Symfony cache system (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

Remove optimization as it's not compatible with Symfony cache system

fixes #2243

@nicolas-grekas Instead of fixing Symfony cache system (which will only happen in a new patch release), I propose to revert these changes. It means no optimization for Twig 1.x, but the optimization is the default in Twig 2.0. So, I don't think this is a big deal.

Commits
-------

d64d320 removed optimization as it's not compatible with Symfony cache system
2016-11-13 07:12:56 -08:00
Fabien Potencier d7062f35b8 exposed a way to access template data and methods in a portable way 2016-11-12 19:45:39 -08:00
Fabien Potencier 827d8e7795 minor #2238 added support for PHP 7 null coalescing operator (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

added support for PHP 7 null coalescing operator

fixes #1979

Commits
-------

6effc9a changed context access to use the PHP 7 null coalescing operator when available
2016-11-12 19:33:53 -08:00