mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
added deprecation notices for deprecated classes
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user