From: James Valleroy <jvalleroy@mailbox.org>
Date: Tue, 24 Aug 2021 13:59:05 -0400
Subject: Remove twig support

Forwarded: not-needed
---
 src/Extractors/Twig.php               |  45 -------------
 tests/AbstractTest.php                |   1 -
 tests/AssetsTest.php                  |  40 ------------
 tests/assets/twig/Csv.csv             |  19 ------
 tests/assets/twig/CsvDictionary.csv   |  10 ---
 tests/assets/twig/Jed.json            |  39 ------------
 tests/assets/twig/Json.json           |  41 ------------
 tests/assets/twig/JsonDictionary.json |  12 ----
 tests/assets/twig/Mo.mo               | Bin 225 -> 0 bytes
 tests/assets/twig/PhpArray.php        |  62 ------------------
 tests/assets/twig/Po.po               |  52 ---------------
 tests/assets/twig/Xliff.xlf           | 116 ----------------------------------
 tests/assets/twig/Yaml.yml            |  16 -----
 tests/assets/twig/YamlDictionary.yml  |  10 ---
 tests/assets/twig/input.php           |  26 --------
 15 files changed, 489 deletions(-)
 delete mode 100644 src/Extractors/Twig.php
 delete mode 100644 tests/assets/twig/Csv.csv
 delete mode 100644 tests/assets/twig/CsvDictionary.csv
 delete mode 100644 tests/assets/twig/Jed.json
 delete mode 100644 tests/assets/twig/Json.json
 delete mode 100644 tests/assets/twig/JsonDictionary.json
 delete mode 100644 tests/assets/twig/Mo.mo
 delete mode 100644 tests/assets/twig/PhpArray.php
 delete mode 100644 tests/assets/twig/Po.po
 delete mode 100644 tests/assets/twig/Xliff.xlf
 delete mode 100644 tests/assets/twig/Yaml.yml
 delete mode 100644 tests/assets/twig/YamlDictionary.yml
 delete mode 100644 tests/assets/twig/input.php

diff --git a/src/Extractors/Twig.php b/src/Extractors/Twig.php
deleted file mode 100644
index 2060d08..0000000
--- a/src/Extractors/Twig.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-namespace Gettext\Extractors;
-
-use Gettext\Translations;
-use Twig_Loader_Array;
-use Twig_Environment;
-use Twig_Source;
-use Twig_Extensions_Extension_I18n;
-
-/**
- * Class to get gettext strings from twig files returning arrays.
- */
-class Twig extends Extractor implements ExtractorInterface
-{
-    public static $options = [
-        'extractComments' => 'notes:',
-        'twig' => null,
-    ];
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function fromString($string, Translations $translations, array $options = [])
-    {
-        $options += static::$options;
-
-        $twig = $options['twig'] ?: static::createTwig();
-
-        PhpCode::fromString($twig->compileSource(new Twig_Source($string, '')), $translations, $options);
-    }
-
-    /**
-     * Returns a Twig instance.
-     *
-     * @return Twig_Environment
-     */
-    protected static function createTwig()
-    {
-        $twig = new Twig_Environment(new Twig_Loader_Array(['' => '']));
-        $twig->addExtension(new Twig_Extensions_Extension_I18n());
-
-        return static::$options['twig'] = $twig;
-    }
-}
diff --git a/tests/AbstractTest.php b/tests/AbstractTest.php
index 49ad4d9..0134a83 100644
--- a/tests/AbstractTest.php
+++ b/tests/AbstractTest.php
@@ -19,7 +19,6 @@ abstract class AbstractTest extends TestCase
         'PhpArray' => 'php',
         'PhpCode' => 'php',
         'Po' => 'po',
-        'Twig' => 'php',
         'Xliff' => 'xlf',
         'Yaml' => 'yml',
         'YamlDictionary' => 'yml',
diff --git a/tests/AssetsTest.php b/tests/AssetsTest.php
index af797a8..c836051 100644
--- a/tests/AssetsTest.php
+++ b/tests/AssetsTest.php
@@ -343,46 +343,6 @@ class AssetsTest extends AbstractTest
         $this->runTestFormat('phpcode3/YamlDictionary', $countTranslations, $countTranslated);
     }
 
-    public function testTwig()
-    {
-        $translations = static::get('twig/input', 'Twig');
-        $countTranslations = 10;
-        $countTranslated = 0;
-        $countHeaders = 8;
-
-        $this->assertCount($countTranslations, $translations);
-        $this->assertCount($countHeaders, $translations->getHeaders());
-        $this->assertEquals(0, $translations->countTranslated());
-
-        //Ignored in php5 because the line numbers doesn't match due different version of twig
-        if (PHP_MAJOR_VERSION >= 7) {
-            $this->assertContent($translations, 'twig/Po');
-            $this->assertContent($translations, 'twig/Xliff');
-        }
-
-        $this->assertContent($translations, 'twig/Mo');
-        $this->assertContent($translations, 'twig/PhpArray');
-        $this->assertContent($translations, 'twig/Jed');
-        $this->assertContent($translations, 'twig/Json');
-        $this->assertContent($translations, 'twig/JsonDictionary');
-        $this->assertContent($translations, 'twig/Csv');
-        $this->assertContent($translations, 'twig/CsvDictionary');
-        $this->assertContent($translations, 'twig/Yaml');
-        $this->assertContent($translations, 'twig/YamlDictionary');
-
-        $this->runTestFormat('twig/Po', $countTranslations, $countTranslated, $countHeaders);
-        $this->runTestFormat('twig/Mo', 0, $countTranslated, $countHeaders);
-        $this->runTestFormat('twig/PhpArray', $countTranslations, $countTranslated, $countHeaders);
-        $this->runTestFormat('twig/Jed', $countTranslations, $countTranslated, 10);
-        $this->runTestFormat('twig/Xliff', $countTranslations, $countTranslated, $countHeaders);
-        $this->runTestFormat('twig/Json', $countTranslations, $countTranslated, $countHeaders);
-        $this->runTestFormat('twig/JsonDictionary', $countTranslations, $countTranslated);
-        $this->runTestFormat('twig/Csv', $countTranslations, $countTranslated, $countHeaders);
-        $this->runTestFormat('twig/CsvDictionary', $countTranslations, $countTranslated);
-        $this->runTestFormat('twig/Yaml', $countTranslations, $countTranslated, $countHeaders);
-        $this->runTestFormat('twig/YamlDictionary', $countTranslations, $countTranslated);
-    }
-
     public function testVueJs()
     {
         $translations = static::get('vuejs/input', 'VueJs');
diff --git a/tests/assets/twig/Csv.csv b/tests/assets/twig/Csv.csv
deleted file mode 100644
index 2221284..0000000
--- a/tests/assets/twig/Csv.csv
+++ /dev/null
@@ -1,19 +0,0 @@
-,,"Content-Transfer-Encoding: 8bit
-Content-Type: text/plain; charset=UTF-8
-Language: 
-Language-Team: 
-Last-Translator: 
-MIME-Version: 1.0
-Project-Id-Version: 
-Report-Msgid-Bugs-To: 
-"
-,"text 1",
-,"text 2",
-,"text 3 (with parenthesis)",
-,"text 4 ""with double quotes""",
-,"text 5 'with escaped single quotes'",
-,"text 6",
-,"text 7 (with parenthesis)",
-,"text 8 ""with escaped double quotes""",
-,"text 9 'with single quotes'",
-,"text 10 with plural",
diff --git a/tests/assets/twig/CsvDictionary.csv b/tests/assets/twig/CsvDictionary.csv
deleted file mode 100644
index 38bfa1b..0000000
--- a/tests/assets/twig/CsvDictionary.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-"text 1",
-"text 2",
-"text 3 (with parenthesis)",
-"text 4 ""with double quotes""",
-"text 5 'with escaped single quotes'",
-"text 6",
-"text 7 (with parenthesis)",
-"text 8 ""with escaped double quotes""",
-"text 9 'with single quotes'",
-"text 10 with plural",
diff --git a/tests/assets/twig/Jed.json b/tests/assets/twig/Jed.json
deleted file mode 100644
index dd53bba..0000000
--- a/tests/assets/twig/Jed.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
-    "messages": {
-        "": {
-            "domain": "messages",
-            "lang": "en",
-            "plural-forms": "nplurals=2; plural=(n != 1);"
-        },
-        "text 1": [
-            ""
-        ],
-        "text 2": [
-            ""
-        ],
-        "text 3 (with parenthesis)": [
-            ""
-        ],
-        "text 4 \"with double quotes\"": [
-            ""
-        ],
-        "text 5 'with escaped single quotes'": [
-            ""
-        ],
-        "text 6": [
-            ""
-        ],
-        "text 7 (with parenthesis)": [
-            ""
-        ],
-        "text 8 \"with escaped double quotes\"": [
-            ""
-        ],
-        "text 9 'with single quotes'": [
-            ""
-        ],
-        "text 10 with plural": [
-            ""
-        ]
-    }
-}
\ No newline at end of file
diff --git a/tests/assets/twig/Json.json b/tests/assets/twig/Json.json
deleted file mode 100644
index e1d17a3..0000000
--- a/tests/assets/twig/Json.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-    "domain": null,
-    "plural-forms": null,
-    "messages": {
-        "": {
-            "": [
-                "Content-Transfer-Encoding: 8bit\nContent-Type: text\/plain; charset=UTF-8\nLanguage: \nLanguage-Team: \nLast-Translator: \nMIME-Version: 1.0\nProject-Id-Version: \nReport-Msgid-Bugs-To: \n"
-            ],
-            "text 1": [
-                ""
-            ],
-            "text 2": [
-                ""
-            ],
-            "text 3 (with parenthesis)": [
-                ""
-            ],
-            "text 4 \"with double quotes\"": [
-                ""
-            ],
-            "text 5 'with escaped single quotes'": [
-                ""
-            ],
-            "text 6": [
-                ""
-            ],
-            "text 7 (with parenthesis)": [
-                ""
-            ],
-            "text 8 \"with escaped double quotes\"": [
-                ""
-            ],
-            "text 9 'with single quotes'": [
-                ""
-            ],
-            "text 10 with plural": [
-                ""
-            ]
-        }
-    }
-}
\ No newline at end of file
diff --git a/tests/assets/twig/JsonDictionary.json b/tests/assets/twig/JsonDictionary.json
deleted file mode 100644
index dcd808a..0000000
--- a/tests/assets/twig/JsonDictionary.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "text 1": "",
-    "text 2": "",
-    "text 3 (with parenthesis)": "",
-    "text 4 \"with double quotes\"": "",
-    "text 5 'with escaped single quotes'": "",
-    "text 6": "",
-    "text 7 (with parenthesis)": "",
-    "text 8 \"with escaped double quotes\"": "",
-    "text 9 'with single quotes'": "",
-    "text 10 with plural": ""
-}
\ No newline at end of file
diff --git a/tests/assets/twig/Mo.mo b/tests/assets/twig/Mo.mo
deleted file mode 100644
index 4451a98..0000000
--- a/tests/assets/twig/Mo.mo
+++ /dev/null
@@ -1,9 +0,0 @@
-Þ•          $       ,       ,   ³   -    Content-Transfer-Encoding: 8bit
-Content-Type: text/plain; charset=UTF-8
-Language: 
-Language-Team: 
-Last-Translator: 
-MIME-Version: 1.0
-Project-Id-Version: 
-Report-Msgid-Bugs-To: 
- 
\ No newline at end of file
diff --git a/tests/assets/twig/PhpArray.php b/tests/assets/twig/PhpArray.php
deleted file mode 100644
index 3e6d2ba..0000000
--- a/tests/assets/twig/PhpArray.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php return array (
-  'domain' => NULL,
-  'plural-forms' => NULL,
-  'messages' => 
-  array (
-    '' => 
-    array (
-      '' => 
-      array (
-        0 => 'Content-Transfer-Encoding: 8bit
-Content-Type: text/plain; charset=UTF-8
-Language: 
-Language-Team: 
-Last-Translator: 
-MIME-Version: 1.0
-Project-Id-Version: 
-Report-Msgid-Bugs-To: 
-',
-      ),
-      'text 1' => 
-      array (
-        0 => '',
-      ),
-      'text 2' => 
-      array (
-        0 => '',
-      ),
-      'text 3 (with parenthesis)' => 
-      array (
-        0 => '',
-      ),
-      'text 4 "with double quotes"' => 
-      array (
-        0 => '',
-      ),
-      'text 5 \'with escaped single quotes\'' => 
-      array (
-        0 => '',
-      ),
-      'text 6' => 
-      array (
-        0 => '',
-      ),
-      'text 7 (with parenthesis)' => 
-      array (
-        0 => '',
-      ),
-      'text 8 "with escaped double quotes"' => 
-      array (
-        0 => '',
-      ),
-      'text 9 \'with single quotes\'' => 
-      array (
-        0 => '',
-      ),
-      'text 10 with plural' => 
-      array (
-        0 => '',
-      ),
-    ),
-  ),
-);
\ No newline at end of file
diff --git a/tests/assets/twig/Po.po b/tests/assets/twig/Po.po
deleted file mode 100644
index 2412307..0000000
--- a/tests/assets/twig/Po.po
+++ /dev/null
@@ -1,52 +0,0 @@
-msgid ""
-msgstr ""
-"Content-Transfer-Encoding: 8bit\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Language: \n"
-"Language-Team: \n"
-"Last-Translator: \n"
-"MIME-Version: 1.0\n"
-"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: \n"
-
-#: ./tests/assets/twig/input.php:40
-msgid "text 1"
-msgstr ""
-
-#: ./tests/assets/twig/input.php:47
-msgid "text 2"
-msgstr ""
-
-#: ./tests/assets/twig/input.php:51
-msgid "text 3 (with parenthesis)"
-msgstr ""
-
-#: ./tests/assets/twig/input.php:55
-msgid "text 4 \"with double quotes\""
-msgstr ""
-
-#: ./tests/assets/twig/input.php:59
-msgid "text 5 'with escaped single quotes'"
-msgstr ""
-
-#: ./tests/assets/twig/input.php:66
-msgid "text 6"
-msgstr ""
-
-#: ./tests/assets/twig/input.php:70
-msgid "text 7 (with parenthesis)"
-msgstr ""
-
-#: ./tests/assets/twig/input.php:74
-msgid "text 8 \"with escaped double quotes\""
-msgstr ""
-
-#: ./tests/assets/twig/input.php:78
-msgid "text 9 'with single quotes'"
-msgstr ""
-
-#. notes: This is an actual note for translators.
-#: ./tests/assets/twig/input.php:84
-msgid "text 10 with plural"
-msgid_plural "The plural form"
-msgstr[0] ""
diff --git a/tests/assets/twig/Xliff.xlf b/tests/assets/twig/Xliff.xlf
deleted file mode 100644
index f6f03d2..0000000
--- a/tests/assets/twig/Xliff.xlf
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="" trgLang="">
-  <file id=".">
-    <notes>
-      <note id="Content-Transfer-Encoding">8bit</note>
-      <note id="Content-Type">text/plain; charset=UTF-8</note>
-      <note id="Language"></note>
-      <note id="Language-Team"></note>
-      <note id="Last-Translator"></note>
-      <note id="MIME-Version">1.0</note>
-      <note id="Project-Id-Version"></note>
-      <note id="Report-Msgid-Bugs-To"></note>
-    </notes>
-    <unit id="6c69ee7f211c640419d5366cc076ae46">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:40</note>
-      </notes>
-      <segment>
-        <source>text 1</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="bb3438fbabd460ea6dbd27d153e2233b">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:47</note>
-      </notes>
-      <segment>
-        <source>text 2</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="9da0d4dc2681bf32793a3fd1b8610cb6">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:51</note>
-      </notes>
-      <segment>
-        <source>text 3 (with parenthesis)</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="e7a56b0f57aa5adc31713088d33ec0d2">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:55</note>
-      </notes>
-      <segment>
-        <source>text 4 "with double quotes"</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="615cfcfa32b34e8057fcbd1651247439">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:59</note>
-      </notes>
-      <segment>
-        <source>text 5 'with escaped single quotes'</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="3e220f99f0eed5cc73ab9c599cecc219">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:66</note>
-      </notes>
-      <segment>
-        <source>text 6</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="61aa602f3e368d98288056b1d693c431">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:70</note>
-      </notes>
-      <segment>
-        <source>text 7 (with parenthesis)</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="477f9325bba9979e86c2db696323e2ba">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:74</note>
-      </notes>
-      <segment>
-        <source>text 8 "with escaped double quotes"</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="f9890d4b371274cf0d5917759b6ff419">
-      <notes>
-        <note category="context"></note>
-        <note category="reference">./tests/assets/twig/input.php:78</note>
-      </notes>
-      <segment>
-        <source>text 9 'with single quotes'</source>
-        <target></target>
-      </segment>
-    </unit>
-    <unit id="d122051296e7f3bf7408762c11f3a026">
-      <notes>
-        <note category="context"></note>
-        <note category="extracted-comment">notes: This is an actual note for translators.</note>
-        <note category="reference">./tests/assets/twig/input.php:84</note>
-      </notes>
-      <segment>
-        <source>text 10 with plural</source>
-        <target></target>
-      </segment>
-    </unit>
-  </file>
-</xliff>
diff --git a/tests/assets/twig/Yaml.yml b/tests/assets/twig/Yaml.yml
deleted file mode 100644
index 2a6a9bc..0000000
--- a/tests/assets/twig/Yaml.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-domain: null
-plural-forms: null
-messages:
-  '':
-    '':
-      - "Content-Transfer-Encoding: 8bit\nContent-Type: text/plain; charset=UTF-8\nLanguage: \nLanguage-Team: \nLast-Translator: \nMIME-Version: 1.0\nProject-Id-Version: \nReport-Msgid-Bugs-To: \n"
-    'text 1': ''
-    'text 2': ''
-    'text 3 (with parenthesis)': ''
-    'text 4 "with double quotes"': ''
-    'text 5 ''with escaped single quotes''': ''
-    'text 6': ''
-    'text 7 (with parenthesis)': ''
-    'text 8 "with escaped double quotes"': ''
-    'text 9 ''with single quotes''': ''
-    'text 10 with plural': ''
diff --git a/tests/assets/twig/YamlDictionary.yml b/tests/assets/twig/YamlDictionary.yml
deleted file mode 100644
index 09fbf2e..0000000
--- a/tests/assets/twig/YamlDictionary.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-'text 1': ''
-'text 2': ''
-'text 3 (with parenthesis)': ''
-'text 4 "with double quotes"': ''
-'text 5 ''with escaped single quotes''': ''
-'text 6': ''
-'text 7 (with parenthesis)': ''
-'text 8 "with escaped double quotes"': ''
-'text 9 ''with single quotes''': ''
-'text 10 with plural': ''
diff --git a/tests/assets/twig/input.php b/tests/assets/twig/input.php
deleted file mode 100644
index ac215b0..0000000
--- a/tests/assets/twig/input.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<header>
-    <h1>{% trans 'text 1' %}</h1>
-</header>
-
-<div>
-    <p>{% trans 'text 2' %}</p>
-    <p>{% trans 'text 3 (with parenthesis)' %}</p>
-    <p>{% trans 'text 4 "with double quotes"' %}</p>
-    <p>{% trans 'text 5 \'with escaped single quotes\'' %}</p>
-</div>
-
-<div>
-    <p>{% trans "text 6" %}</p>
-    <p>{% trans "text 7 (with parenthesis)" %}</p>
-    <p>{% trans "text 8 \"with escaped double quotes\"" %}</p>
-    <p>{% trans "text 9 'with single quotes'" %}</p>
-    <p>
-    {% trans %}
-        text 10 with plural
-    {% plural 5 %}
-        The plural form
-    {% notes %}
-        This is an actual note for translators.
-    {% endtrans %}
-    </p>
-</div>
