mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 03:57:21 +00:00
Fix tests
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 @@ use Twig\TwigFilter;
|
||||
|
||||
class CssInlinerExtension extends AbstractExtension
|
||||
{
|
||||
public function getFilters()
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('inline_css', [self::class, 'inlineCss'], ['is_safe' => ['all']]),
|
||||
|
||||
@@ -17,7 +17,7 @@ use Twig\TwigFilter;
|
||||
|
||||
class InkyExtension extends AbstractExtension
|
||||
{
|
||||
public function getFilters()
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('inky_to_html', [self::class, 'inky'], ['is_safe' => ['html']]),
|
||||
|
||||
@@ -156,7 +156,7 @@ final class IntlExtension extends AbstractExtension
|
||||
$this->numberFormatterPrototype = $numberFormatterPrototype;
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
// internationalized names
|
||||
@@ -177,7 +177,7 @@ final class IntlExtension extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
// internationalized names
|
||||
|
||||
@@ -17,7 +17,7 @@ use Twig\TwigFilter;
|
||||
|
||||
final class MarkdownExtension extends AbstractExtension
|
||||
{
|
||||
public function getFilters()
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('markdown_to_html', ['Twig\\Extra\\Markdown\\MarkdownRuntime', 'convert'], ['is_safe' => ['all']]),
|
||||
|
||||
@@ -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')));
|
||||
|
||||
@@ -32,7 +32,7 @@ final class StringExtension extends AbstractExtension
|
||||
$this->slugger = $slugger ?: new AsciiSlugger();
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('u', [$this, 'createUnicodeString']),
|
||||
|
||||
Reference in New Issue
Block a user