Deprecated Features¶
This document lists deprecated features in Twig 2.x. Deprecated features are kept for backward compatibility and removed in the next major release (a feature that was deprecated in Twig 2.x is removed in Twig 3.0).
Inheritance¶
- Defining a “block” definition in a non-capturing block in a child template is
deprecated since Twig 2.5.0. In Twig 3.0, it will throw a
Twig_Error_Syntaxexception. It does not work anyway, so most projects won’t need to do anything to upgrade.
Errors¶
- Passing a string as the
$sourceargument onTwig_Errorconstructor is deprecated since Twig 2.6.1. Pass an instance ofTwig_Sourceinstead.
Tags¶
- Using the
spacelesstag at the root level of a child template is deprecated in Twig 2.5.0. This does not work as one would expect it to work anyway. In Twig 3.0, it will throw aTwig_Error_Syntaxexception.
Final Classes¶
The following classes are marked as @final in Twig 2 and will be final in
3.0:
Twig_Node_ModuleTwig_FilterTwig_FunctionTwig_TestTwig_Profiler_Profile