Remove useless twig class aliases
[MAILPOET-2692]
This commit is contained in:
committed by
Veljko V
parent
bac418e2b5
commit
5ce08d045e
@@ -243,7 +243,10 @@ foreach ($replacements as $singleFile) {
|
||||
file_put_contents($singleFile['file'], $data);
|
||||
}
|
||||
|
||||
// Remove unwanted class aliases
|
||||
// Remove unwanted class aliases in lib/Twig subdirectories
|
||||
// We need to keep first level files in lib/Twig since most of them are still needed
|
||||
exec("find ../vendor-prefixed/twig/twig/lib/Twig -maxdepth 1 -mindepth 1 -type d -exec rm -rf '{}' \;");
|
||||
// Fix rest of the files in lib
|
||||
// Files in twig/lib directory contain class aliases which makes namespaced classes global
|
||||
// e.g. \class_alias('MailPoetVendor\\Twig_CompilerInterface', 'Twig_CompilerInterface', \false);
|
||||
$iterator = new RecursiveDirectoryIterator("../vendor-prefixed/twig/twig/lib", RecursiveDirectoryIterator::SKIP_DOTS);
|
||||
|
@@ -9,7 +9,7 @@ use MailPoet\WP\Functions as WPFunctions;
|
||||
class FunctionsTest extends \MailPoetTest {
|
||||
public function testItExecutesIsRtlFunction() {
|
||||
$template = ['template' => '{% if is_rtl() %}rtl{% endif %}'];
|
||||
$twig = new \MailPoetVendor\Twig_Environment(new \MailPoetVendor\Twig_Loader_Array($template));
|
||||
$twig = new \MailPoetVendor\Twig_Environment(new \MailPoetVendor\Twig\Loader\ArrayLoader($template));
|
||||
WPFunctions::set(Stub::make(new WPFunctions, [
|
||||
'isRtl' => Stub::consecutive(true, false),
|
||||
]));
|
||||
|
Reference in New Issue
Block a user