Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
replaced remaining deprecated Twig classes with namespaced classes
Browse files Browse the repository at this point in the history
  • Loading branch information
nutama committed Mar 25, 2019
1 parent 3d0fa46 commit aa0c724
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Bundle/Twig/Token/WebpackTokenParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Hostnet\Bundle\WebpackBundle\Twig\Node\WebpackNode;
use Hostnet\Bundle\WebpackBundle\Twig\TwigExtension;
use Hostnet\Component\Webpack\Asset\TwigParser;
use Twig\Error\SyntaxError;
use Twig\Extension\ExtensionInterface;
use Twig\Loader\LoaderInterface;
use Twig\Parser;
Expand Down Expand Up @@ -78,7 +79,7 @@ public function parse(Token $token)
$export_type = $stream->expect(Token::NAME_TYPE)->getValue();
if (false === \in_array($export_type, ['js', 'css', 'inline'])) {
// This exception will include the template filename by itself.
throw new \Twig_Error_Syntax(sprintf(
throw new SyntaxError(sprintf(
'Expected export type "inline", "js" or "css", got "%s" at line %d.',
$export_type,
$lineno
Expand Down
3 changes: 2 additions & 1 deletion test/Bundle/Twig/Token/WebpackTokenParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Hostnet\Bundle\WebpackBundle\Twig\TwigExtension;
use PHPUnit\Framework\TestCase;
use Twig\Loader\LoaderInterface;

/**
* @covers \Hostnet\Bundle\WebpackBundle\Twig\Token\WebpackTokenParser
Expand All @@ -16,7 +17,7 @@ class WebpackTokenParserTest extends TestCase
{
public function testParser()
{
$loader = $this->prophesize(\Twig_LoaderInterface::class)->reveal();
$loader = $this->prophesize(LoaderInterface::class)->reveal();
$extension = new TwigExtension(
$loader,
__DIR__,
Expand Down
5 changes: 3 additions & 2 deletions test/Bundle/Twig/TwigExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Hostnet\Bundle\WebpackBundle\Twig;

use PHPUnit\Framework\TestCase;
use Twig\Loader\LoaderInterface;

/**
* @covers \Hostnet\Bundle\WebpackBundle\Twig\TwigExtension
Expand All @@ -15,7 +16,7 @@ class TwigExtensionTest extends TestCase
{
public function testExtension()
{
$loader = $this->prophesize(\Twig_LoaderInterface::class)->reveal();
$loader = $this->prophesize(LoaderInterface::class)->reveal();
$extension = new TwigExtension($loader, __DIR__, '/', '/bundles', '/shared.js', '/shared.css');

self::assertEquals('webpack', $extension->getName());
Expand All @@ -29,7 +30,7 @@ public function testExtension()
*/
public function testAssets($expected, $asset, $web_dir, $dump_path, $public_path)
{
$loader = $this->prophesize(\Twig_LoaderInterface::class)->reveal();
$loader = $this->prophesize(LoaderInterface::class)->reveal();
$extension = new TwigExtension($loader, $web_dir, $public_path, $dump_path, '', '');
self::assertEquals($expected, $extension->webpackPublic($asset));
}
Expand Down
2 changes: 1 addition & 1 deletion test/Component/Asset/TwigParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TwigParserTest extends TestCase
private $tracker;

/**
* @var \Twig_Environment
* @var Environment
*/
private $twig;

Expand Down

0 comments on commit aa0c724

Please sign in to comment.