Skip to content

Commit 57f1451

Browse files
committed
Support for Twig 3.
1 parent b866172 commit 57f1451

40 files changed

+59
-87
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
@@ -34,7 +34,7 @@ public function __construct(Packages $packages)
3434
*
3535
* @return TwigFunction[]
3636
*/
37-
public function getFunctions()
37+
public function getFunctions(): array
3838
{
3939
return [
4040
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
@@ -43,7 +43,7 @@ public function __construct($fileLinkFormat, string $projectDir, string $charset
4343
*
4444
* @return TwigFilter[]
4545
*/
46-
public function getFilters()
46+
public function getFilters(): array
4747
{
4848
return [
4949
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
@@ -39,7 +39,7 @@ public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
3939
/**
4040
* @return TwigFunction[]
4141
*/
42-
public function getFunctions()
42+
public function getFunctions(): array
4343
{
4444
return [
4545
new TwigFunction('dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]),
@@ -49,7 +49,7 @@ public function getFunctions()
4949
/**
5050
* @return TokenParserInterface[]
5151
*/
52-
public function getTokenParsers()
52+
public function getTokenParsers(): array
5353
{
5454
return [new DumpTokenParser()];
5555
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ExpressionExtension extends AbstractExtension
2727
*
2828
* @return TwigFunction[]
2929
*/
30-
public function getFunctions()
30+
public function getFunctions(): array
3131
{
3232
return [
3333
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
@@ -33,7 +33,7 @@ class FormExtension extends AbstractExtension
3333
*
3434
* @return TokenParserInterface[]
3535
*/
36-
public function getTokenParsers()
36+
public function getTokenParsers(): array
3737
{
3838
return [
3939
// {% form_theme form "SomeBundle::widgets.twig" %}
@@ -46,7 +46,7 @@ public function getTokenParsers()
4646
*
4747
* @return TwigFunction[]
4848
*/
49-
public function getFunctions()
49+
public function getFunctions(): array
5050
{
5151
return [
5252
new TwigFunction('form_widget', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
@@ -68,7 +68,7 @@ public function getFunctions()
6868
*
6969
* @return TwigFilter[]
7070
*/
71-
public function getFilters()
71+
public function getFilters(): array
7272
{
7373
return [
7474
new TwigFilter('humanize', ['Symfony\Component\Form\FormRenderer', 'humanize']),
@@ -81,7 +81,7 @@ public function getFilters()
8181
*
8282
* @return TwigTest[]
8383
*/
84-
public function getTests()
84+
public function getTests(): array
8585
{
8686
return [
8787
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
@@ -35,7 +35,7 @@ public function __construct(UrlHelper $urlHelper)
3535
*
3636
* @return TwigFunction[]
3737
*/
38-
public function getFunctions()
38+
public function getFunctions(): array
3939
{
4040
return [
4141
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
@@ -25,7 +25,7 @@ class HttpKernelExtension extends AbstractExtension
2525
/**
2626
* @return TwigFunction[]
2727
*/
28-
public function getFunctions()
28+
public function getFunctions(): array
2929
{
3030
return [
3131
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
@@ -34,7 +34,7 @@ public function __construct(LogoutUrlGenerator $generator)
3434
*
3535
* @return TwigFunction[]
3636
*/
37-
public function getFunctions()
37+
public function getFunctions(): array
3838
{
3939
return [
4040
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)