Revert "Use the official twig StringLoaderExtension"

This reverts commit b2036b765f.
This commit is contained in:
Belle Aerni 2023-01-18 22:05:50 -08:00
parent b2036b765f
commit 612adb5a17
3 changed files with 116 additions and 35 deletions

View file

@ -14,6 +14,7 @@
"league/commonmark": "^2.3",
"elgigi/commonmark-emoji": "^2.0",
"twig/twig": "^3.5",
"shapecode/twig-string-loader": "^1.1",
"donatello-za/rake-php-plus": "^1.0",
"embed/embed": "^4.4",
"nyholm/psr7": "^1.5"

147
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ea1fd1c14d6c8fe48dba5d365ff65efc",
"content-hash": "2b32ca6ab5978e9e11f071023d5dd4c5",
"packages": [
{
"name": "composer/ca-bundle",
@ -700,16 +700,16 @@
},
{
"name": "nette/utils",
"version": "v3.2.9",
"version": "v3.2.8",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c"
"reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c",
"reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c",
"url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368",
"reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368",
"shasum": ""
},
"require": {
@ -719,7 +719,6 @@
"nette/di": "<3.0.6"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "dev-master",
"nette/tester": "~2.0",
"phpstan/phpstan": "^1.0",
"tracy/tracy": "^2.3"
@ -780,9 +779,9 @@
],
"support": {
"issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v3.2.9"
"source": "https://github.com/nette/utils/tree/v3.2.8"
},
"time": "2023-01-18T03:26:20+00:00"
"time": "2022-09-12T23:36:20+00:00"
},
{
"name": "nyholm/psr7",
@ -1178,6 +1177,88 @@
},
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "shapecode/twig-string-loader",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/shapecode/twig-string-loader.git",
"reference": "c40d3a9f123e22f2e81f1c79d4d3a96455e21b2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/shapecode/twig-string-loader/zipball/c40d3a9f123e22f2e81f1c79d4d3a96455e21b2d",
"reference": "c40d3a9f123e22f2e81f1c79d4d3a96455e21b2d",
"shasum": ""
},
"require": {
"php": "^7.4|^8.0",
"twig/twig": "^2.11|^3.0"
},
"require-dev": {
"doctrine/coding-standard": "^9.0",
"maglnet/composer-require-checker": "^2.0|^3.8|^4.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "^3.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"Shapecode\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nikita Loges",
"email": "dev@loges.one",
"homepage": "https://loges.one"
}
],
"description": "A string loader for twig",
"homepage": "https://github.com/shapecode/twig-string-loader",
"keywords": [
"loader",
"shapecode",
"string",
"template",
"twig"
],
"support": {
"email": "support@shapecode.de",
"issues": "https://github.com/shapecode/twig-string-loader/issues",
"source": "https://github.com/shapecode/twig-string-loader/releases",
"wiki": "https://github.com/shapecode/twig-string-loader/wiki"
},
"funding": [
{
"url": "http://paypal.me/nloges",
"type": "custom"
},
{
"url": "https://github.com/nicklog",
"type": "github"
},
{
"url": "https://liberapay.com/nicklog",
"type": "liberapay"
}
],
"time": "2022-01-15T12:43:29+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.0.2",
@ -1776,16 +1857,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.15.3",
"version": "v4.15.2",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039"
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039",
"reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc",
"shasum": ""
},
"require": {
@ -1826,9 +1907,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2"
},
"time": "2023-01-16T22:05:37+00:00"
"time": "2022-11-12T15:38:23+00:00"
},
{
"name": "phar-io/manifest",
@ -1943,16 +2024,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.9.13",
"version": "1.9.11",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f"
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/a0922426da3a7d0d9334e99a363f7f9f6e23e84f",
"reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/60f3d68481eef216199eae7a2603cd5fe124d464",
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464",
"shasum": ""
},
"require": {
@ -1982,7 +2063,7 @@
],
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.9.13"
"source": "https://github.com/phpstan/phpstan/tree/1.9.11"
},
"funding": [
{
@ -1998,7 +2079,7 @@
"type": "tidelift"
}
],
"time": "2023-01-18T15:26:53+00:00"
"time": "2023-01-12T14:04:13+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -2320,20 +2401,20 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.28",
"version": "9.5.27",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "954ca3113a03bf780d22f07bf055d883ee04b65e"
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e",
"reference": "954ca3113a03bf780d22f07bf055d883ee04b65e",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38",
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.3.1 || ^2",
"doctrine/instantiator": "^1.3.1",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
@ -2402,7 +2483,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27"
},
"funding": [
{
@ -2418,20 +2499,20 @@
"type": "tidelift"
}
],
"time": "2023-01-14T12:32:24+00:00"
"time": "2022-12-09T07:31:23+00:00"
},
{
"name": "rector/rector",
"version": "0.15.7",
"version": "0.15.5",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f"
"reference": "b27945f63527b540dba09a4f4612bc738da9c285"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/a43370e1f4c47aaa96c0f85bf9db73db1be7552f",
"reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/b27945f63527b540dba09a4f4612bc738da9c285",
"reference": "b27945f63527b540dba09a4f4612bc738da9c285",
"shasum": ""
},
"require": {
@ -2466,7 +2547,7 @@
"description": "Instant Upgrade and Automated Refactoring of any PHP code",
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/0.15.7"
"source": "https://github.com/rectorphp/rector/tree/0.15.5"
},
"funding": [
{
@ -2474,7 +2555,7 @@
"type": "github"
}
],
"time": "2023-01-13T21:14:19+00:00"
"time": "2023-01-12T19:13:08+00:00"
},
{
"name": "sebastian/cli-parser",

View file

@ -24,12 +24,11 @@ class AntTwig
$templatePath = AntTools::repairFilePath(antThemePath . '/' . $theme . '/' . 'Templates');
$filesystemLoader = new \Twig\Loader\FilesystemLoader($templatePath);
$stringLoader = new \Twig\Extension\StringLoaderExtension();
$stringLoader = new \Shapecode\Twig\Loader\StringLoader();
$chainLoader = new \Twig\Loader\ChainLoader([$stringLoader, $filesystemLoader]);
$twigEnvironment = new \Twig\Environment($chainLoader, [
'cache' => $twigCache,
'debug' => AntConfig::currentConfig('debug'),
'strict_variables' => AntConfig::currentConfig('debug'),
]);
return $twigEnvironment->render($content, $params);