added deprecation notices for deprecated classes

This commit is contained in:
Fabien Potencier
2015-08-18 09:04:31 +02:00
parent c6ab7de8f2
commit cc980282de
14 changed files with 31 additions and 2 deletions
+2
View File
@@ -9,6 +9,8 @@
* 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);
/**
* Autoloads Twig classes.
*
+1 -1
View File
@@ -1198,7 +1198,7 @@ class Twig_Environment
}
$this->extensionInitialized = true;
$this->parsers = new Twig_TokenParserBroker();
$this->parsers = new Twig_TokenParserBroker(array(), array(), false);
$this->filters = array();
$this->functions = array();
$this->tests = array();
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
/**
* Represents a function template filter.
*
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
/**
* Represents a method template filter.
*
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
/**
* Represents a template filter as a node.
*
+2
View File
@@ -10,6 +10,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED);
/**
* Represents a function template function.
*
+2
View File
@@ -10,6 +10,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED);
/**
* Represents a method template function.
*
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.', E_USER_DEPRECATED);
/**
* Represents a template function as a node.
*
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_Loader_Array instead.', E_USER_DEPRECATED);
/**
* Loads a template from a string.
*
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Test_Function class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED);
/**
* Represents a function template test.
*
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Test_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleTest instead.', E_USER_DEPRECATED);
/**
* Represents a method template test.
*
+2
View File
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Test_Node class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED);
/**
* Represents a template test as a Node.
*
+5 -1
View File
@@ -29,8 +29,12 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
* @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances
* @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances
*/
public function __construct($parsers = array(), $brokers = array())
public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
@trigger_error('The '.__CLASS__.' class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED);
}
foreach ($parsers as $parser) {
if (!$parser instanceof Twig_TokenParserInterface) {
throw new LogicException('$parsers must a an array of Twig_TokenParserInterface');
+3
View File
@@ -11,6 +11,9 @@
class Twig_Tests_AutoloaderTest extends PHPUnit_Framework_TestCase
{
/**
* @group legacy
*/
public function testAutoload()
{
$this->assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig');