diff --git a/composer.json b/composer.json index 7bc6dcfde..0b31319a7 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,9 @@ "symfony/filesystem": "^2.7 || ^3.4 || ^4.0", "twig/twig": "^1.41 || ^2.12" }, + "conflict": { + "drush/drush": "< 10.3.2" + }, "bin": [ "bin/dcg" ], diff --git a/src/bootstrap.php b/src/bootstrap.php index 0cfb078a1..b6685cee6 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -51,22 +51,3 @@ function dcg_get_twig_environment($loader) { } return $environment; } - -// Determine major Twig version. -// \Twig\Environment::MAJOR_VERSION is not suitable here because of -// https://github.com/twigphp/Twig/pull/2945 -// Use this workaround as drupal/drupal is locked on Twig 1.38. -list($twig_major_version) = sscanf(Environment::VERSION, '%d.%d.%d'); - -// \Twig\Environment::tokenize() signature has been changed in Twig 2, so that -// it is not possible to maintain the same \Twig\Environment sub-class for both -// Twig versions. -$twig_environment_class = sprintf('DrupalCodeGenerator\Twig\Twig%dEnvironment', $twig_major_version); -if (!class_exists('DrupalCodeGenerator\Twig\TwigEnvironment')) { - class_alias($twig_environment_class, 'DrupalCodeGenerator\Twig\TwigEnvironment'); -} - -// Legacy TwigEnvironment class is still used in Drush. -if (!class_exists('DrupalCodeGenerator\TwigEnvironment')) { - class_alias($twig_environment_class, 'DrupalCodeGenerator\TwigEnvironment'); -}