mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-04 19:07:11 +00:00
documentation #4958 3.x doc fixes (fabpot)
This PR was squashed before being merged into the 3.x branch. Discussion ---------- 3.x doc fixes Commits -------1478f9efcdFix the class name and a missing parenthesis in the runtime loader examplee883536e64Replace the deprecated twig_test_even function in the custom test exampledb3aeb7379Use the current variable node class in the node tree example
This commit is contained in:
+3
-3
@@ -848,7 +848,7 @@ The ``getTests()`` method lets you add new test functions::
|
||||
public function getTests()
|
||||
{
|
||||
return [
|
||||
new \Twig\TwigTest('even', 'twig_test_even'),
|
||||
new \Twig\TwigTest('even', fn (int $value): bool => 0 === $value % 2),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -919,8 +919,8 @@ a runtime extension using one of the runtime loaders::
|
||||
}
|
||||
|
||||
$twig = new \Twig\Environment($loader);
|
||||
$twig->addExtension(new \Twig\Extension\AttributeExtension(ProjectExtension::class);
|
||||
$twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryLoader([
|
||||
$twig->addExtension(new \Twig\Extension\AttributeExtension(ProjectExtension::class));
|
||||
$twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader([
|
||||
ProjectExtension::class => function () use ($lipsumProvider) {
|
||||
return new ProjectExtension($lipsumProvider);
|
||||
},
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ Here is the output for the ``Hello {{ name }}`` template:
|
||||
\Twig\Node\ModuleNode(
|
||||
\Twig\Node\TextNode(Hello )
|
||||
\Twig\Node\PrintNode(
|
||||
\Twig\Node\Expression\NameExpression(name)
|
||||
\Twig\Node\Expression\Variable\ContextVariable(name)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user