mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 10:26:32 +00:00
Merge branch '3.x' into 4.x
* 3.x: Fix tests Allow extra extensions to use Twig 4
This commit is contained in:
@@ -16,7 +16,7 @@ use Twig\Extra\Cache\TokenParser\CacheTokenParser;
|
||||
|
||||
final class CacheExtension extends AbstractExtension
|
||||
{
|
||||
public function getTokenParsers()
|
||||
public function getTokenParsers(): array
|
||||
{
|
||||
return [
|
||||
new CacheTokenParser(),
|
||||
|
||||
@@ -78,11 +78,9 @@ class FunctionalTest extends TestCase
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
public function load($class)
|
||||
public function load(string $class): ?object
|
||||
{
|
||||
if (CacheRuntime::class === $class) {
|
||||
return new CacheRuntime($this->cache);
|
||||
}
|
||||
return CacheRuntime::class === $class ? new CacheRuntime($this->cache) : null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -30,11 +30,9 @@ class IntegrationTest extends IntegrationTestCase
|
||||
{
|
||||
return [
|
||||
new class() implements RuntimeLoaderInterface {
|
||||
public function load($class)
|
||||
public function load(string $class): ?object
|
||||
{
|
||||
if (CacheRuntime::class === $class) {
|
||||
return new CacheRuntime(new ArrayAdapter());
|
||||
}
|
||||
return CacheRuntime::class === $class ? new CacheRuntime(new ArrayAdapter()) : null;
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/cache": "^5.4|^6.4|^7.0",
|
||||
"twig/twig": "^3.12"
|
||||
"twig/twig": "^3.12|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"php": ">=8.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"tijsverkoyen/css-to-inline-styles": "^2.0",
|
||||
"twig/twig": "^3.0"
|
||||
"twig/twig": "^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"php": ">=8.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/mime": "^5.4|^6.4|^7.0",
|
||||
"twig/twig": "^3.0"
|
||||
"twig/twig": "^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"php": ">=8.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"lorenzo/pinky": "^1.0.5",
|
||||
"twig/twig": "^3.0"
|
||||
"twig/twig": "^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"twig/twig": "^3.10",
|
||||
"twig/twig": "^3.10|^4.0",
|
||||
"symfony/intl": "^5.4|^6.4|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
@@ -27,7 +27,7 @@ class FunctionalTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getMarkdownTests
|
||||
*/
|
||||
public function testMarkdown(string $template, string $expected): void
|
||||
public function testMarkdown(string $template, string $expected)
|
||||
{
|
||||
foreach ([LeagueMarkdown::class, ErusevMarkdown::class, /* MichelfMarkdown::class, */ DefaultMarkdown::class] as $class) {
|
||||
$twig = new Environment(new ArrayLoader([
|
||||
@@ -48,11 +48,9 @@ EOF
|
||||
$this->class = $class;
|
||||
}
|
||||
|
||||
public function load($c)
|
||||
public function load(string $c): ?object
|
||||
{
|
||||
if (MarkdownRuntime::class === $c) {
|
||||
return new $c(new $this->class());
|
||||
}
|
||||
return MarkdownRuntime::class === $c ? new $c(new $this->class()) : null;
|
||||
}
|
||||
});
|
||||
$this->assertMatchesRegularExpression('{'.$expected.'}m', trim($twig->render('index')));
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"twig/twig": "^3.0"
|
||||
"twig/twig": "^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"php": ">=8.2",
|
||||
"symfony/string": "^5.4|^6.4|^7.0",
|
||||
"symfony/translation-contracts": "^1.1|^2|^3",
|
||||
"twig/twig": "^3.0"
|
||||
"twig/twig": "^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"php": ">=8.2",
|
||||
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
|
||||
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
|
||||
"twig/twig": "^3.0"
|
||||
"twig/twig": "^3.0|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"league/commonmark": "^1.0|^2.0",
|
||||
|
||||
Reference in New Issue
Block a user