Skip to content

Commit af7d80b

Browse files
committed
Support for Twig 3.
1 parent b64fdb7 commit af7d80b

39 files changed

+55
-53
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"ext-xml": "*",
2121
"doctrine/event-manager": "~1.0",
2222
"doctrine/persistence": "~1.0",
23-
"twig/twig": "^2.10",
23+
"twig/twig": "^2.10|^3",
2424
"psr/cache": "~1.0",
2525
"psr/container": "^1.0",
2626
"psr/link": "^1.0",

src/Symfony/Bridge/Twig/Extension/AssetExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(Packages $packages)
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function getFunctions()
35+
public function getFunctions(): array
3636
{
3737
return [
3838
new TwigFunction('asset', [$this, 'getAssetUrl']),

src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct($fileLinkFormat, string $projectDir, string $charset
4141
/**
4242
* {@inheritdoc}
4343
*/
44-
public function getFilters()
44+
public function getFilters(): array
4545
{
4646
return [
4747
new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html']]),

src/Symfony/Bridge/Twig/Extension/DumpExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
3535
$this->dumper = $dumper;
3636
}
3737

38-
public function getFunctions()
38+
public function getFunctions(): array
3939
{
4040
return [
4141
new TwigFunction('dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]),
4242
];
4343
}
4444

45-
public function getTokenParsers()
45+
public function getTokenParsers(): array
4646
{
4747
return [new DumpTokenParser()];
4848
}

src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ExpressionExtension extends AbstractExtension
2525
/**
2626
* {@inheritdoc}
2727
*/
28-
public function getFunctions()
28+
public function getFunctions(): array
2929
{
3030
return [
3131
new TwigFunction('expression', [$this, 'createExpression']),

src/Symfony/Bridge/Twig/Extension/FormExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FormExtension extends AbstractExtension
3030
/**
3131
* {@inheritdoc}
3232
*/
33-
public function getTokenParsers()
33+
public function getTokenParsers(): array
3434
{
3535
return [
3636
// {% form_theme form "SomeBundle::widgets.twig" %}
@@ -41,7 +41,7 @@ public function getTokenParsers()
4141
/**
4242
* {@inheritdoc}
4343
*/
44-
public function getFunctions()
44+
public function getFunctions(): array
4545
{
4646
return [
4747
new TwigFunction('form_widget', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
@@ -61,7 +61,7 @@ public function getFunctions()
6161
/**
6262
* {@inheritdoc}
6363
*/
64-
public function getFilters()
64+
public function getFilters(): array
6565
{
6666
return [
6767
new TwigFilter('humanize', ['Symfony\Component\Form\FormRenderer', 'humanize']),
@@ -72,7 +72,7 @@ public function getFilters()
7272
/**
7373
* {@inheritdoc}
7474
*/
75-
public function getTests()
75+
public function getTests(): array
7676
{
7777
return [
7878
new TwigTest('selectedchoice', 'Symfony\Bridge\Twig\Extension\twig_is_selected_choice'),

src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(UrlHelper $urlHelper)
3333
/**
3434
* {@inheritdoc}
3535
*/
36-
public function getFunctions()
36+
public function getFunctions(): array
3737
{
3838
return [
3939
new TwigFunction('absolute_url', [$this, 'generateAbsoluteUrl']),

src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class HttpKernelExtension extends AbstractExtension
2424
{
25-
public function getFunctions()
25+
public function getFunctions(): array
2626
{
2727
return [
2828
new TwigFunction('render', [HttpKernelRuntime::class, 'renderFragment'], ['is_safe' => ['html']]),

src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(LogoutUrlGenerator $generator)
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function getFunctions()
35+
public function getFunctions(): array
3636
{
3737
return [
3838
new TwigFunction('logout_url', [$this, 'getLogoutUrl']),

src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(Profile $profile, Stopwatch $stopwatch = null)
3131
$this->events = new \SplObjectStorage();
3232
}
3333

34-
public function enter(Profile $profile)
34+
public function enter(Profile $profile): void
3535
{
3636
if ($this->stopwatch && $profile->isTemplate()) {
3737
$this->events[$profile] = $this->stopwatch->start($profile->getName(), 'template');
@@ -40,7 +40,7 @@ public function enter(Profile $profile)
4040
parent::enter($profile);
4141
}
4242

43-
public function leave(Profile $profile)
43+
public function leave(Profile $profile): void
4444
{
4545
parent::leave($profile);
4646

0 commit comments

Comments
 (0)