From 623f7fba37ead125aa98d54f5452835fea78b14a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jul 2023 15:32:57 +0200 Subject: [PATCH] [Translation] Deprecate the PhpExtractor --- reference/dic_tags.rst | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index cdbb7788032..7b953e20e3c 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -1071,9 +1071,22 @@ file When executing the ``translation:extract`` command, it uses extractors to extract translation messages from a file. By default, the Symfony Framework -has a :class:`Symfony\\Bridge\\Twig\\Translation\\TwigExtractor` and a -:class:`Symfony\\Component\\Translation\\Extractor\\PhpExtractor`, which -help to find and extract translation keys from Twig templates and PHP files. +has a :class:`Symfony\\Bridge\\Twig\\Translation\\TwigExtractor` and a PHP +extractor to find and extract translation keys from Twig templates and PHP files. + +Symfony includes two PHP extractors: :class:`Symfony\\Component\\Translation\\Extractor\\PhpExtractor` +and :class:`Symfony\\Component\\Translation\\Extractor\\PhpAstExtractor`. The +first one is simple but doesn't require to install any packages; the second one +is much more advanced, but requires to install this dependency in your project: + +.. code-block:: terminal + + $ composer require nikic/php-parser + +.. deprecated:: 6.2 + + The ``PhpExtractor`` class is deprecated since Symfony 6.2. The ``PhpAstExtractor`` + class will be the only PHP extractor available starting from Symfony 7.0. You can create your own extractor by creating a class that implements :class:`Symfony\\Component\\Translation\\Extractor\\ExtractorInterface`