Skip to content

Commit

Permalink
Merge pull request #30 from notFloran/fix-Twig_Extension_GlobalsInter…
Browse files Browse the repository at this point in the history
…face-deprecation

Fix Twig deprecations
  • Loading branch information
notFloran authored Apr 11, 2019
2 parents b73440d + d780ba2 commit 0ec2c5f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/Twig/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace NotFloran\MjmlBundle\Twig;

use NotFloran\MjmlBundle\Renderer\RendererInterface;
use Twig_Extension;
use Twig_Extension_GlobalsInterface;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface
class Extension extends AbstractExtension implements GlobalsInterface
{
/**
* @var RendererInterface
Expand Down
8 changes: 4 additions & 4 deletions src/Twig/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace NotFloran\MjmlBundle\Twig;

use Twig_Node;
use Twig_Compiler;
use Twig\Node\Node as Twig_Node;
use Twig\Compiler;

class Node extends Twig_Node
{
Expand All @@ -20,10 +20,10 @@ public function __construct(Twig_Node $value, $line, $tag = null)
/**
* Compile the provided mjml into html.
*
* @param Twig_Compiler $compiler
* @param Compiler $compiler
* @return void
*/
public function compile(Twig_Compiler $compiler)
public function compile(Compiler $compiler)
{
$compiler->addDebugInfo($this)
->write('ob_start();' . PHP_EOL)
Expand Down
16 changes: 8 additions & 8 deletions src/Twig/TokenParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace NotFloran\MjmlBundle\Twig;

use NotFloran\MjmlBundle\Renderer\RendererInterface;
use Twig_TokenParser;
use Twig_Token;
use Twig\TokenParser\AbstractTokenParser;
use Twig\Token;

class TokenParser extends Twig_TokenParser
class TokenParser extends AbstractTokenParser
{
/**
* @var RendererInterface
Expand All @@ -21,21 +21,21 @@ public function __construct(RendererInterface $mjml)
/**
* Parse the twig tag.
*
* @param Twig_Token $token
* @param Token $token
* @return Node|\Twig_Node
* @throws \Twig_Error_Syntax
*/
public function parse(Twig_Token $token)
public function parse(Token $token)
{
$line = $token->getLine();

$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
$this->parser->getStream()->expect(Token::BLOCK_END_TYPE);

$body = $this->parser->subparse(function (Twig_Token $token) {
$body = $this->parser->subparse(function (Token $token) {
return $token->test('endmjml');
}, true);

$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
$this->parser->getStream()->expect(Token::BLOCK_END_TYPE);

return new Node($body, $line, $this->getTag());
}
Expand Down

0 comments on commit 0ec2c5f

Please sign in to comment.