From 41d702d6bea299a6b1b4970d40dbdd6f124aefb0 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 14 Apr 2024 10:33:37 +0200 Subject: [PATCH] Add a deprecation notice when using AbstractNodeVisitor (deprecated since 2.9) --- CHANGELOG | 1 + doc/deprecated.rst | 6 ++++++ src/NodeVisitor/AbstractNodeVisitor.php | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e604e7397..f8f073c83 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ # 3.9.0 (2024-XX-XX) + * Deprecate AbstractNodeVisitor * Add a new "yield" mode for output generation; Node implementations that use "echo" or "print" should use "yield" instead; all Node implementations should be flagged with `#[YieldReady]` once they've been made ready for "yield"; diff --git a/doc/deprecated.rst b/doc/deprecated.rst index 2c697c69d..b4cdf774d 100644 --- a/doc/deprecated.rst +++ b/doc/deprecated.rst @@ -17,3 +17,9 @@ Extensions * All functions defined in Twig extensions are marked as internal as of Twig 3.9.0, and will be removed in Twig 4.0. They have been replaced by internal methods on their respective extension classes. + +Node Visitors +------------- + +* The ``Twig\NodeVisitor\AbstractNodeVisitor`` class is deprecated, implement the + ``Twig\NodeVisitor\NodeVisitorInterface`` interface instead. diff --git a/src/NodeVisitor/AbstractNodeVisitor.php b/src/NodeVisitor/AbstractNodeVisitor.php index d7036ae55..5de35fd09 100644 --- a/src/NodeVisitor/AbstractNodeVisitor.php +++ b/src/NodeVisitor/AbstractNodeVisitor.php @@ -17,9 +17,9 @@ use Twig\Node\Node; /** * Used to make node visitors compatible with Twig 1.x and 2.x. * - * To be removed in Twig 3.1. - * * @author Fabien Potencier + * + * @deprecated since 3.9 (to be removed in 4.0) */ abstract class AbstractNodeVisitor implements NodeVisitorInterface {