deprecated function/test/filter/tag overriding

This commit is contained in:
Fabien Potencier
2016-12-17 22:01:48 +01:00
parent 9dd38e29e3
commit 7ffb188710
5 changed files with 25 additions and 8 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
* 1.29.1 (2017-XX-XX)
* 1.30.0 (2017-XX-XX)
* deprecated function/test/filter/tag overriding
* deprecated the "disable_c_ext" attribute on Twig_Node_Expression_GetAttr
* 1.29.0 (2016-12-13)
+1 -1
View File
@@ -40,7 +40,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.29-dev"
"dev-master": "1.30-dev"
}
}
}
+1 -1
View File
@@ -15,7 +15,7 @@
#ifndef PHP_TWIG_H
#define PHP_TWIG_H
#define PHP_TWIG_VERSION "1.29.1-DEV"
#define PHP_TWIG_VERSION "1.30.0-DEV"
#include "php.h"
+4 -4
View File
@@ -16,11 +16,11 @@
*/
class Twig_Environment
{
const VERSION = '1.29.1-DEV';
const VERSION_ID = 12901;
const VERSION = '1.30.0-DEV';
const VERSION_ID = 13000;
const MAJOR_VERSION = 1;
const MINOR_VERSION = 29;
const RELEASE_VERSION = 1;
const MINOR_VERSION = 30;
const RELEASE_VERSION = 0;
const EXTRA_VERSION = 'DEV';
protected $charset;
+17 -1
View File
@@ -29,6 +29,10 @@ class Twig_Extension_Staging extends Twig_Extension
public function addFunction($name, $function)
{
if (isset($this->functions[$name])) {
@trigger_error(sprintf('Overriding function "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
}
$this->functions[$name] = $function;
}
@@ -39,6 +43,10 @@ class Twig_Extension_Staging extends Twig_Extension
public function addFilter($name, $filter)
{
if (isset($this->filters[$name])) {
@trigger_error(sprintf('Overriding filter "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
}
$this->filters[$name] = $filter;
}
@@ -59,7 +67,11 @@ class Twig_Extension_Staging extends Twig_Extension
public function addTokenParser(Twig_TokenParserInterface $parser)
{
$this->tokenParsers[] = $parser;
if (isset($this->tokenParsers[$parser->getTag()])) {
@trigger_error(sprintf('Overriding tag "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $parser->getTag()), E_USER_DEPRECATED);
}
$this->tokenParsers[$parser->getTag()] = $parser;
}
public function getTokenParsers()
@@ -79,6 +91,10 @@ class Twig_Extension_Staging extends Twig_Extension
public function addTest($name, $test)
{
if (isset($this->tests[$name])) {
@trigger_error(sprintf('Overriding test "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
}
$this->tests[$name] = $test;
}