Skip to content

Commit

Permalink
Twig version 1.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tbreuss committed Jan 30, 2016
1 parent 39fca40 commit 2b63ae8
Show file tree
Hide file tree
Showing 35 changed files with 255 additions and 174 deletions.
22 changes: 22 additions & 0 deletions plugins/twig/vendor/twig/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
* 1.24.0 (2016-01-25)

* adding support for the ?? operator
* fixed the defined test when used on a constant, a map, or a sequence
* undeprecated _self (should only be used to get the template name, not the template instance)
* fixed parsing on PHP7

* 1.23.3 (2016-01-11)

* fixed typo

* 1.23.2 (2015-01-11)

* added versions in deprecated messages
* made file cache tolerant for trailing (back)slashes on directory configuration
* deprecated unused Twig_Node_Expression_ExtensionReference class

* 1.23.1 (2015-11-05)

* fixed some exception messages which triggered PHP warnings
* fixed BC on Twig_Test_NodeTestCase

* 1.23.0 (2015-10-29)

* deprecated the possibility to override an extension by registering another one with the same name
Expand Down
2 changes: 1 addition & 1 deletion plugins/twig/vendor/twig/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009-2014 by the Twig Team.
Copyright (c) 2009-2016 by the Twig Team.

Some rights reserved.

Expand Down
6 changes: 3 additions & 3 deletions plugins/twig/vendor/twig/lib/Twig/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/

@trigger_error('The Twig_Autoloader class is deprecated and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED);
@trigger_error('The Twig_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED);

/**
* Autoloads Twig classes.
*
* @author Fabien Potencier <[email protected]>
*
* @deprecated Use Composer instead. Will be removed in Twig 2.0.
* @deprecated since 1.21 and will be removed in 2.0. Use Composer instead. 2.0.
*/
class Twig_Autoloader
{
Expand All @@ -27,7 +27,7 @@ class Twig_Autoloader
*/
public static function register($prepend = false)
{
@trigger_error('Using Twig_Autoloader is deprecated. Use Composer instead.', E_USER_DEPRECATED);
@trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED);

if (PHP_VERSION_ID < 50300) {
spl_autoload_register(array(__CLASS__, 'autoload'));
Expand Down
4 changes: 2 additions & 2 deletions plugins/twig/vendor/twig/lib/Twig/Cache/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Twig_Cache_Filesystem implements Twig_CacheInterface
*/
public function __construct($directory, $options = 0)
{
$this->directory = $directory;
$this->directory = rtrim($directory, '\/').'/';
$this->options = $options;
}

Expand All @@ -38,7 +38,7 @@ public function generateKey($name, $className)
{
$hash = hash('sha256', $className);

return $this->directory.'/'.$hash[0].$hash[1].'/'.$hash.'.php';
return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php';
}

/**
Expand Down
50 changes: 25 additions & 25 deletions plugins/twig/vendor/twig/lib/Twig/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class Twig_Environment
{
const VERSION = '1.23.0';
const VERSION = '1.24.0';

protected $charset;
protected $loader;
Expand Down Expand Up @@ -93,7 +93,7 @@ public function __construct(Twig_LoaderInterface $loader = null, $options = arra
if (null !== $loader) {
$this->setLoader($loader);
} else {
@trigger_error('Not passing a Twig_LoaderInterface as the first constructor argument of Twig_Environment is deprecated.', E_USER_DEPRECATED);
@trigger_error('Not passing a Twig_LoaderInterface as the first constructor argument of Twig_Environment is deprecated since version 1.21.', E_USER_DEPRECATED);
}

$options = array_merge(array(
Expand Down Expand Up @@ -123,14 +123,14 @@ public function __construct(Twig_LoaderInterface $loader = null, $options = arra
if (is_string($this->originalCache)) {
$r = new ReflectionMethod($this, 'writeCacheFile');
if ($r->getDeclaringClass()->getName() !== __CLASS__) {
@trigger_error('The Twig_Environment::writeCacheFile method is deprecated and will be removed in Twig 2.0.', E_USER_DEPRECATED);
@trigger_error('The Twig_Environment::writeCacheFile method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);

$this->bcWriteCacheFile = true;
}

$r = new ReflectionMethod($this, 'getCacheFilename');
if ($r->getDeclaringClass()->getName() !== __CLASS__) {
@trigger_error('The Twig_Environment::getCacheFilename method is deprecated and will be removed in Twig 2.0.', E_USER_DEPRECATED);
@trigger_error('The Twig_Environment::getCacheFilename method is deprecated since version 1.22 and will be removed in Twig 2.0.', E_USER_DEPRECATED);

$this->bcGetCacheFilename = true;
}
Expand Down Expand Up @@ -265,7 +265,7 @@ public function setCache($cache)
$this->originalCache = $cache;
$this->cache = new Twig_Cache_Null();
} elseif (null === $cache) {
@trigger_error('Using "null" as the cache strategy is deprecated and will be removed in Twig 2.0.', E_USER_DEPRECATED);
@trigger_error('Using "null" as the cache strategy is deprecated since version 1.23 and will be removed in Twig 2.0.', E_USER_DEPRECATED);
$this->originalCache = false;
$this->cache = new Twig_Cache_Null();
} elseif ($cache instanceof Twig_CacheInterface) {
Expand All @@ -286,7 +286,7 @@ public function setCache($cache)
*/
public function getCacheFilename($name)
{
@trigger_error(sprintf('The %s method is deprecated and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);

$key = $this->cache->generateKey($name, $this->getTemplateClass($name));

Expand Down Expand Up @@ -325,7 +325,7 @@ public function getTemplateClass($name, $index = null)
*/
public function getTemplateClassPrefix()
{
@trigger_error(sprintf('The %s method is deprecated and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);

return $this->templateClassPrefix;
}
Expand Down Expand Up @@ -515,7 +515,7 @@ public function resolveTemplate($names)
*/
public function clearTemplateCache()
{
@trigger_error(sprintf('The %s method is deprecated and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s method is deprecated since version 1.18.3 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);

$this->loadedTemplates = array();
}
Expand All @@ -527,7 +527,7 @@ public function clearTemplateCache()
*/
public function clearCacheFiles()
{
@trigger_error(sprintf('The %s method is deprecated and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);

if (is_string($this->originalCache)) {
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->originalCache), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
Expand Down Expand Up @@ -732,12 +732,12 @@ public function initRuntime()
{
$this->runtimeInitialized = true;

foreach ($this->getExtensions() as $extension) {
foreach ($this->getExtensions() as $name => $extension) {
if (!$extension instanceof Twig_Extension_InitRuntimeInterface) {
$m = new ReflectionMethod($extension, 'initRuntime');

if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Defining the initRuntime() method in an extension is deprecated. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Defining the initRuntime() method in the "%s" extension is deprecated since version 1.23. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).', $name), E_USER_DEPRECATED);
}
}

Expand Down Expand Up @@ -787,7 +787,7 @@ public function addExtension(Twig_ExtensionInterface $extension)
}

if (isset($this->extensions[$name])) {
@trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $name), E_USER_DEPRECATED);
@trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $name), E_USER_DEPRECATED);
}

$this->lastModifiedExtension = 0;
Expand All @@ -806,7 +806,7 @@ public function addExtension(Twig_ExtensionInterface $extension)
*/
public function removeExtension($name)
{
@trigger_error(sprintf('The %s method is deprecated and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s method is deprecated since version 1.12 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);

if ($this->extensionInitialized) {
throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name));
Expand Down Expand Up @@ -928,7 +928,7 @@ public function addFilter($name, $filter = null)
$filter = $name;
$name = $filter->getName();
} else {
@trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFilter" instead when defining filter "%s".', __METHOD__, $name), E_USER_DEPRECATED);
}

if ($this->extensionInitialized) {
Expand Down Expand Up @@ -988,7 +988,7 @@ public function registerUndefinedFilterCallback($callable)
/**
* Gets the registered Filters.
*
* Be warned that this method cannot return filters defined with registerUndefinedFunctionCallback.
* Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
*
* @return Twig_FilterInterface[] An array of Twig_FilterInterface instances
*
Expand Down Expand Up @@ -1019,7 +1019,7 @@ public function addTest($name, $test = null)
$test = $name;
$name = $test->getName();
} else {
@trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleTest" instead when defining test "%s".', __METHOD__, $name), E_USER_DEPRECATED);
}

if ($this->extensionInitialized) {
Expand Down Expand Up @@ -1079,7 +1079,7 @@ public function addFunction($name, $function = null)
$function = $name;
$name = $function->getName();
} else {
@trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Passing a name as a first argument to the %s method is deprecated since version 1.21. Pass an instance of "Twig_SimpleFunction" instead when defining function "%s".', __METHOD__, $name), E_USER_DEPRECATED);
}

if ($this->extensionInitialized) {
Expand Down Expand Up @@ -1172,7 +1172,7 @@ public function addGlobal($name, $value)

if (!array_key_exists($name, $this->globals)) {
// The deprecation notice must be turned into the following exception in Twig 2.0
@trigger_error(sprintf('Registering global variable "%s" at runtime or when the extensions have already been initialized is deprecated.', $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Registering global variable "%s" at runtime or when the extensions have already been initialized is deprecated since version 1.21.', $name), E_USER_DEPRECATED);
//throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
}
}
Expand Down Expand Up @@ -1256,20 +1256,20 @@ public function getBinaryOperators()
*/
public function computeAlternatives($name, $items)
{
@trigger_error(sprintf('The %s method is deprecated and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s method is deprecated since version 1.23 and will be removed in Twig 2.0.', __METHOD__), E_USER_DEPRECATED);

return Twig_Error_Syntax::computeAlternatives($name, $items);
}

protected function initGlobals()
{
$globals = array();
foreach ($this->extensions as $extension) {
foreach ($this->extensions as $name => $extension) {
if (!$extension instanceof Twig_Extension_GlobalsInterface) {
$m = new ReflectionMethod($extension, 'getGlobals');

if ('Twig_Extension' !== $m->getDeclaringClass()->getName()) {
@trigger_error(sprintf('Defining the getGlobals() method in an extension is deprecated without explicitly implementing Twig_Extension_GlobalsInterface.', $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Defining the getGlobals() method in the "%s" extension without explicitly implementing Twig_Extension_GlobalsInterface is deprecated since version 1.23.', $name), E_USER_DEPRECATED);
}
}

Expand Down Expand Up @@ -1314,7 +1314,7 @@ protected function initExtension(Twig_ExtensionInterface $extension)
if ($filter instanceof Twig_SimpleFilter) {
$name = $filter->getName();
} else {
@trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated. Use Twig_SimpleFilter instead.', get_class($filter), $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Using an instance of "%s" for filter "%s" is deprecated since version 1.21. Use Twig_SimpleFilter instead.', get_class($filter), $name), E_USER_DEPRECATED);
}

$this->filters[$name] = $filter;
Expand All @@ -1325,7 +1325,7 @@ protected function initExtension(Twig_ExtensionInterface $extension)
if ($function instanceof Twig_SimpleFunction) {
$name = $function->getName();
} else {
@trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated. Use Twig_SimpleFunction instead.', get_class($function), $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Using an instance of "%s" for function "%s" is deprecated since version 1.21. Use Twig_SimpleFunction instead.', get_class($function), $name), E_USER_DEPRECATED);
}

$this->functions[$name] = $function;
Expand All @@ -1336,7 +1336,7 @@ protected function initExtension(Twig_ExtensionInterface $extension)
if ($test instanceof Twig_SimpleTest) {
$name = $test->getName();
} else {
@trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated. Use Twig_SimpleTest instead.', get_class($test), $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Using an instance of "%s" for test "%s" is deprecated since version 1.21. Use Twig_SimpleTest instead.', get_class($test), $name), E_USER_DEPRECATED);
}

$this->tests[$name] = $test;
Expand All @@ -1347,7 +1347,7 @@ protected function initExtension(Twig_ExtensionInterface $extension)
if ($parser instanceof Twig_TokenParserInterface) {
$this->parsers->addTokenParser($parser);
} elseif ($parser instanceof Twig_TokenParserBrokerInterface) {
@trigger_error('Registering a Twig_TokenParserBrokerInterface instance is deprecated.', E_USER_DEPRECATED);
@trigger_error('Registering a Twig_TokenParserBrokerInterface instance is deprecated since version 1.21.', E_USER_DEPRECATED);

$this->parsers->addTokenParserBroker($parser);
} else {
Expand Down
Loading

0 comments on commit 2b63ae8

Please sign in to comment.