8000 [TwigBridge] Support for Twig 3 by derrabus · Pull Request #33039 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBridge] Support for Twig 3 #33039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Support for Twig 3.
  • Loading branch information
derrabus committed Aug 21, 2019
commit f30edcab65d43ee85db28a7cb68274a1df93985f
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-xml": "*",
"doctrine/event-manager": "~1.0",
"doctrine/persistence": "~1.0",
"twig/twig": "^2.10",
"twig/twig": "^2.10|^3",
"psr/cache": "~1.0",
"psr/container": "^1.0",
"psr/link": "^1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/AssetExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class AssetExtension extends AbstractExtension
{
Expand All @@ -36,7 +36,7 @@ public function __construct(Packages $packages)
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('asset', [$this, 'getAssetUrl']),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/CodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class CodeExtension extends AbstractExtension
{
Expand All @@ -45,7 +45,7 @@ public function __construct($fileLinkFormat, string $projectDir, string $charset
*
* @return TwigFilter[]
*/
public function getFilters()
public function getFilters(): array
{
return [
new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html']]),
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/CsrfExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
* @author Titouan Galopin <galopintitouan@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class CsrfExtension extends AbstractExtension
{
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/CsrfRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
* @author Titouan Galopin <galopintitouan@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class CsrfRuntime
{
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Bridge/Twig/Extension/DumpExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.4
* @final
*/
class DumpExtension extends AbstractExtension
{
Expand All @@ -41,7 +41,7 @@ public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
/**
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]),
Expand All @@ -51,7 +51,7 @@ public function getFunctions()
/**
* @return TokenParserInterface[]
*/
public function getTokenParsers()
public function getTokenParsers(): array
{
return [new DumpTokenParser()];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class ExpressionExtension extends AbstractExtension
{
Expand All @@ -29,7 +29,7 @@ class ExpressionExtension extends AbstractExtension
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('expression', [$this, 'createExpression']),
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Bridge/Twig/Extension/FormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author Fabien Potencier <fabien@symfony.com>
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class FormExtension extends AbstractExtension
{
Expand All @@ -35,7 +35,7 @@ class FormExtension extends AbstractExtension
*
* @return TokenParserInterface[]
*/
public function getTokenParsers()
public function getTokenParsers(): array
{
return [
// {% form_theme form "SomeBundle::widgets.twig" %}
Expand All @@ -48,7 +48,7 @@ public function getTokenParsers()
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('form_widget', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
Expand All @@ -70,7 +70,7 @@ public function getFunctions()
*
* @return TwigFilter[]
*/
public function getFilters()
public function getFilters(): array
{
return [
new TwigFilter('humanize', ['Symfony\Component\Form\FormRenderer', 'humanize']),
Expand All @@ -83,7 +83,7 @@ public function getFilters()
*
* @return TwigTest[]
*/
public function getTests()
public function getTests(): array
{
return [
new TwigTest('selectedchoice', 'Symfony\Bridge\Twig\Extension\twig_is_selected_choice'),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class HttpFoundationExtension extends AbstractExtension
{
Expand All @@ -37,7 +37,7 @@ public function __construct(UrlHelper $urlHelper)
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('absolute_url', [$this, 'generateAbsoluteUrl']),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class HttpKernelExtension extends AbstractExtension
{
/**
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('render', [HttpKernelRuntime::class, 'renderFragment'], ['is_safe' => ['html']]),
Expand Down 10000
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class HttpKernelRuntime
{
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Jeremy Mikola <jmikola@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class LogoutUrlExtension extends AbstractExtension
{
Expand All @@ -36,7 +36,7 @@ public function __construct(LogoutUrlGenerator $generator)
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('logout_url', [$this, 'getLogoutUrl']),
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class ProfilerExtension extends BaseProfilerExtension
{
Expand All @@ -33,7 +33,7 @@ public function __construct(Profile $profile, Stopwatch $stopwatch = null)
$this->events = new \SplObjectStorage();
}

public function enter(Profile $profile)
public function enter(Profile $profile): void
{
if ($this->stopwatch && $profile->isTemplate()) {
$this->events[$profile] = $this->stopwatch->start($profile->getName(), 'template');
Expand All @@ -42,7 +42,7 @@ public function enter(Profile $profile)
parent::enter($profile);
}

public function leave(Profile $profile)
public function leave(Profile $profile): void
{
parent::leave($profile);

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/RoutingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class RoutingExtension extends AbstractExtension
{
Expand All @@ -39,7 +39,7 @@ public function __construct(UrlGeneratorInterface $generator)
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/SecurityExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class SecurityExtension extends AbstractExtension
{
Expand Down Expand Up @@ -55,7 +55,7 @@ public function isGranted($role, object $object = null, string $field = null)
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('is_granted', [$this, 'isGranted']),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @author Wouter J <wouter@wouterj.nl>
*
* @final since Symfony 4.4
* @final
*/
class StopwatchExtension extends AbstractExtension
{
Expand All @@ -42,7 +42,7 @@ public function getStopwatch()
/**
* @return TokenParserInterface[]
*/
public function getTokenParsers()
public function getTokenParsers(): array
{
return [
/*
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class WebLinkExtension extends AbstractExtension
{
Expand All @@ -38,7 +38,7 @@ public function __construct(RequestStack $requestStack)
*
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('link', [$this, 'link']),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final since Symfony 4.4
* @final
*/
class WorkflowExtension extends AbstractExtension
{
Expand All @@ -36,7 +36,7 @@ public function __construct(Registry $workflowRegistry)
/**
* @return TwigFunction[]
*/
public function getFunctions()
public function getFunctions(): array
{
return [
new TwigFunction('workflow_can', [$this, 'canTransition']),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Extension/YamlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class YamlExtension extends AbstractExtension
{
Expand All @@ -30,7 +30,7 @@ class YamlExtension extends AbstractExtension
*
* @return TwigFilter[]
*/
public function getFilters()
public function getFilters(): array
{
return [
new TwigFilter('yaml_encode', [$this, 'encode']),
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Node/DumpNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* @author Julien Galenski <julien.galenski@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class DumpNode extends Node
{
Expand All @@ -37,7 +37,7 @@ public function __construct($varPrefix, Node $values = null, int $lineno, string
/**
* {@inheritdoc}
*/
public function compile(Compiler $compiler)
public function compile(Compiler $compiler): void
{
$compiler
->write("if (\$this->env->isDebug()) {\n")
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Node/FormThemeNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @final since Symfony 4.4
* @final
*/
class FormThemeNode extends Node
{
Expand All @@ -27,7 +27,7 @@ public function __construct(Node $form, Node $resources, int $lineno, string $ta
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag);
}

public function compile(Compiler $compiler)
public function compile(Compiler $compiler): void
{
$compiler
->addDebugInfo($this)
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Node/RenderBlockNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @final since Symfony 4.4
* @final
*/
class RenderBlockNode extends FunctionExpression
{
public function compile(Compiler $compiler)
public function compile(Compiler $compiler): void
{
$compiler->addDebugInfo($this);
$arguments = iterator_to_array($this->getNode('arguments'));
Expand Down
Loading
0