This PR was merged into the 1.x branch.
Discussion
----------
Traversable support for 'replace', 'merge' and 'sort'
Add traversable support to:
* replace
* merge
* sort
Other changes:
* Removes some not need checks
* ~~Make unit test skip if it cannot write to cache because of the user running the test~~
* Tests added for traversable support
* Doc updates
Deprecating:
I think the undocumented (and multibyte not supported) use of `replace(string, string)` can be removed in Twig 2.0.
Adding MB support and documentation of the feature was turned down (https://github.com/twigphp/Twig/pull/1618)
However removing it is a BC break (https://github.com/twigphp/Twig/pull/1445#issuecomment-48746926)
Commits
-------
2a17303 Mark test skipped if cannot write to cache directory.
This PR was merged into the 1.x branch.
Discussion
----------
Fix variable names for the deprecation triggering code
Closes https://github.com/twigphp/Twig/issues/1800
Commits
-------
dd446c0 Fix variable names for the deprecation triggering code
This PR was merged into the 1.x branch.
Discussion
----------
fix escaping strategy detection based on filename
Fixessymfony/symfony#15095
It previously excluded any fileextension (not just `.twig`) which is pretty wrong.
Commits
-------
e403363 fix escaping strategy detection based on filename
This PR was squashed before being merged into the 1.x branch (closes#1796).
Discussion
----------
OPcache support fix
According this recipe http://twig.sensiolabs.org/doc/recipes.html#refreshing-modified-templates-when-opcache-or-apc-is-enabled when using OPcache:
```
class Twig_Environment_APC extends Twig_Environment
{
protected function writeCacheFile($file, $content)
{
parent::writeCacheFile($file, $content);
// Compile cached file into bytecode cache
if (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) {
opcache_compile_file($file);
} elseif (extension_loaded('apc') && ini_get('apc.enabled')) {
apc_compile_file($file);
}
}
}
```
it takes an error:
```
Cannot redeclare class __TwigTemplate_12e7606b10ee267fa4174f660f86451aed936cc5680300a6442092f337c910cf
```
This is due to fact that the function ```opcache_compile_file($file)``` executes the file. But it should not do so in accordance with the documentation: http://php.net/manual/en/function.opcache-compile-file.php
There is a bug report: https://bugs.php.net/bug.php?id=66066 (since 2013 👎).
This patch prevents reexecution of the compiled template.
Commits
-------
2c4af24 OPcache support fix
* 1.x:
bumped version to 1.21.2-DEV
prepared the 1.21.1 release
fixed support for Twig_Test_* classes
bumped version to 1.21.1-DEV
prepared the 1.21.0 release
This PR was merged into the 1.x branch.
Discussion
----------
fixed support for Twig_Test_* classes (regression)
fixes#1791
Commits
-------
9561582 fixed support for Twig_Test_* classes
This PR was merged into the 1.x branch.
Discussion
----------
added a note about TwigFiddle
Not sure where to mention it, the IDE section seems ok.
ping @ninsuo
Commits
-------
bc9911e added a note about TwigFiddle
This PR was merged into the 2.0-dev branch.
Discussion
----------
moved more methods/properties to private
I'd like to make even more properties/methods private in 2.0. We can always put them back to protected if that makes sense.
Commits
-------
905a2a8 moved more methods/properties to private
This PR was merged into the 2.0-dev branch.
Discussion
----------
Faster filesystem loader master
We need to keep calling `findTemplate()` for all methods to keep BC.
Commits
-------
3da99ce removed BC break in filesystem loader
638eedb Revert "removed an unneeded protected method"
This PR was merged into the 1.x branch.
Discussion
----------
optimized the filesystem loader
* added a cache for templates that do not exist
* sped up Filesystem::exists() by avoiding the creation of exceptions
same as d2b97b49f2 that was reverted because of a BC break
and same as what is in 2.0 (but in a BC way).
Commits
-------
21b128a optimized the filesystem loader
This PR was merged into the 2.0-dev branch.
Discussion
----------
Callable typehint
Add callable typehint which are available since php 5.4 so are safe to use in twig 2.0.
Commits
-------
465208d add callable typehints
This PR was merged into the 1.x branch.
Discussion
----------
move property initialization to the declaration when possible
From #1781
Commits
-------
5951d1f move property initialization to the declaration when possible
* added a cache for templates that do not exist
* sped up Filesystem::exists() by avoiding the creation of exceptions
same as d2b97b49f2 that was reverted because of a BC break
and same as what is in 2.0 (but in a BC way).
* 1.x:
fix escaping strategy that is an array but not a callable
use travis cache for composer and fast finish
fix php 5.2 compatibility
enhance travis setup
Add missing deprecation triggers
Fix the deprecation warning for functions and tests
bumped version to 1.21
avoid a PHPUnit message when no legacy tests are in the test suite
This PR was merged into the 1.x branch.
Discussion
----------
Add missing deprecation triggers
Assetic is extending the ``Twig_Function`` class directly currently, and this was not triggering any deprecation warning
Commits
-------
cb98576 Add missing deprecation triggers
This PR was merged into the 1.x branch.
Discussion
----------
enhance travis setup
- require php 7 to pass
- allow failures for php7 + twig extension
- use container-based infrastructure
- <del>composer self-update to get rid of the outdated warning</del>
- add travis cache for composer
- use travis fast finish
Commits
-------
11baf55 use travis cache for composer and fast finish
7b579df fix php 5.2 compatibility
118598e enhance travis setup
- require php 7 pass (except with extension)
- use container-based infrastructure
- composer self-update to get rid of the outdated warning
- install --prefer-source because travis auth fails against dist
This PR was merged into the 1.x branch.
Discussion
----------
Fix the deprecation warning for functions and tests
Otherwise, when a function does not define any filter, the message looks like that:
```
Using an instance of "Twig_Environment" for function "nelmio_js_logger" is deprecated. Use Twig_SimpleFunction instead.
```
This happens because the notice about the undefined variable gets silenced too, and ``get_class(null)`` returns the current class.
Commits
-------
1687097 Fix the deprecation warning for functions and tests