diff --git a/Tests/Twig/Extension/PhoneNumberHelperExtensionTest.php b/Tests/Twig/Extension/PhoneNumberHelperExtensionTest.php index a6e0daf2..03ce5ead 100644 --- a/Tests/Twig/Extension/PhoneNumberHelperExtensionTest.php +++ b/Tests/Twig/Extension/PhoneNumberHelperExtensionTest.php @@ -11,10 +11,8 @@ namespace Misd\PhoneNumberBundle\Tests\Twig\Extension; - use Misd\PhoneNumberBundle\Twig\Extension\PhoneNumberHelperExtension; - /** * Phone number helper Twig extension test. */ @@ -41,7 +39,7 @@ protected function setUp() public function testConstructor() { - $this->assertInstanceOf('Twig_Extension', $this->extension); + $this->assertInstanceOf('Twig\Extension\AbstractExtension', $this->extension); } public function testGetFunctions() @@ -49,7 +47,7 @@ public function testGetFunctions() $functions = $this->extension->getFunctions(); $this->assertCount(2, $functions); - $this->assertInstanceOf('Twig_SimpleFunction', $functions[0]); + $this->assertInstanceOf('Twig\TwigFunction', $functions[0]); $this->assertSame('phone_number_format', $functions[0]->getName()); $callable = $functions[0]->getCallable(); @@ -57,7 +55,7 @@ public function testGetFunctions() $this->assertSame($this->helper, $callable[0]); $this->assertSame('format', $callable[1]); - $this->assertInstanceOf('Twig_SimpleFunction', $functions[1]); + $this->assertInstanceOf('Twig\TwigFunction', $functions[1]); $this->assertSame('phone_number_is_type', $functions[1]->getName()); $callable = $functions[1]->getCallable(); @@ -71,7 +69,7 @@ public function testGetFilters() $filters = $this->extension->getFilters(); $this->assertCount(1, $filters); - $this->assertInstanceOf('Twig_SimpleFilter', $filters[0]); + $this->assertInstanceOf('Twig\TwigFilter', $filters[0]); $this->assertSame('phone_number_format', $filters[0]->getName()); $callable = $filters[0]->getCallable(); @@ -85,7 +83,7 @@ public function testGetTests() $tests = $this->extension->getTests(); $this->assertCount(1, $tests); - $this->assertInstanceOf('Twig_SimpleTest', $tests[0]); + $this->assertInstanceOf('Twig\TwigTest', $tests[0]); $this->assertSame('phone_number_of_type', $tests[0]->getName()); $callable = $tests[0]->getCallable(); diff --git a/Twig/Extension/PhoneNumberHelperExtension.php b/Twig/Extension/PhoneNumberHelperExtension.php index fdccc101..5bbfa78f 100644 --- a/Twig/Extension/PhoneNumberHelperExtension.php +++ b/Twig/Extension/PhoneNumberHelperExtension.php @@ -12,11 +12,15 @@ namespace Misd\PhoneNumberBundle\Twig\Extension; use Misd\PhoneNumberBundle\Templating\Helper\PhoneNumberHelper; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; +use Twig\TwigFunction; +use Twig\TwigTest; /** * Phone number helper Twig extension. */ -class PhoneNumberHelperExtension extends \Twig_Extension +class PhoneNumberHelperExtension extends AbstractExtension { /** * Phone number helper. @@ -41,8 +45,8 @@ public function __construct(PhoneNumberHelper $helper) public function getFunctions() { return array( - new \Twig_SimpleFunction('phone_number_format', array($this->helper, 'format'), array('deprecated' => '1.2')), - new \Twig_SimpleFunction('phone_number_is_type', array($this->helper, 'isType'), array('deprecated' => '1.2')), + new TwigFunction('phone_number_format', array($this->helper, 'format'), array('deprecated' => '1.2')), + new TwigFunction('phone_number_is_type', array($this->helper, 'isType'), array('deprecated' => '1.2')), ); } @@ -52,7 +56,7 @@ public function getFunctions() public function getFilters() { return array( - new \Twig_SimpleFilter('phone_number_format', array($this->helper, 'format')), + new TwigFilter('phone_number_format', array($this->helper, 'format')), ); } @@ -62,7 +66,7 @@ public function getFilters() public function getTests() { return array( - new \Twig_SimpleTest('phone_number_of_type', array($this->helper, 'isType')), + new TwigTest('phone_number_of_type', array($this->helper, 'isType')), ); } diff --git a/composer.json b/composer.json index 3ef12f77..36dc5193 100644 --- a/composer.json +++ b/composer.json @@ -21,10 +21,11 @@ "symfony/serializer": "~2.7|~3.1|~4.0", "symfony/templating": "~2.7|~3.0|~4.0", "symfony/twig-bundle": "~2.7|~3.0|~4.0", - "symfony/validator": "~2.7|~3.0|~4.0" + "symfony/validator": "~2.7|~3.0|~4.0", + "symfony/intl": "~2.7|~3.0|~4.0" }, "conflict": { - "twig/twig": "<1.12.0" + "twig/twig": "<1.34.0" }, "suggest": { "doctrine/doctrine-bundle": "Add a DBAL mapping type",