forked from egeloen/IvoryGoogleMapBundle
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from rabauss/feature/twig3
Fix compatibility with twig version 3
- Loading branch information
Showing
6 changed files
with
24 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,17 @@ | |
namespace Ivory\GoogleMapBundle\Tests\Twig; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\Environment; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\Loader\FilesystemLoader; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
abstract class AbstractExtensionTest extends TestCase | ||
{ | ||
/** | ||
* @var \Twig_Environment | ||
* @var Environment | ||
*/ | ||
private $twig; | ||
|
||
|
@@ -28,17 +31,17 @@ abstract class AbstractExtensionTest extends TestCase | |
*/ | ||
protected function setUp() | ||
{ | ||
$this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem([])); | ||
$this->twig = new Environment(new FilesystemLoader([])); | ||
$this->twig->addExtension($this->createExtension()); | ||
} | ||
|
||
/** | ||
* @return \Twig_Extension | ||
* @return AbstractExtension | ||
*/ | ||
abstract protected function createExtension(); | ||
|
||
/** | ||
* @return \Twig_Environment | ||
* @return Environment | ||
*/ | ||
protected function getTwig() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,13 @@ | |
namespace Ivory\GoogleMapBundle\Twig; | ||
|
||
use Ivory\GoogleMap\Helper\ApiHelper; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFunction; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
class ApiExtension extends \Twig_Extension | ||
class ApiExtension extends AbstractExtension | ||
{ | ||
/** | ||
* @var ApiHelper | ||
|
@@ -39,7 +41,7 @@ public function getFunctions() | |
$functions = []; | ||
|
||
foreach ($this->getMapping() as $name => $method) { | ||
$functions[] = new \Twig_SimpleFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
$functions[] = new TwigFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
} | ||
|
||
return $functions; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,13 @@ | |
|
||
use Ivory\GoogleMap\Helper\MapHelper; | ||
use Ivory\GoogleMap\Map; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFunction; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
class MapExtension extends \Twig_Extension | ||
class MapExtension extends AbstractExtension | ||
{ | ||
/** | ||
* @var MapHelper | ||
|
@@ -40,7 +42,7 @@ public function getFunctions() | |
$functions = []; | ||
|
||
foreach ($this->getMapping() as $name => $method) { | ||
$functions[] = new \Twig_SimpleFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
$functions[] = new TwigFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
} | ||
|
||
return $functions; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,13 @@ | |
|
||
use Ivory\GoogleMap\Helper\PlaceAutocompleteHelper; | ||
use Ivory\GoogleMap\Place\Autocomplete; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFunction; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
class PlaceAutocompleteExtension extends \Twig_Extension | ||
class PlaceAutocompleteExtension extends AbstractExtension | ||
{ | ||
/** | ||
* @var PlaceAutocompleteHelper | ||
|
@@ -40,7 +42,7 @@ public function getFunctions() | |
$functions = []; | ||
|
||
foreach ($this->getMapping() as $name => $method) { | ||
$functions[] = new \Twig_SimpleFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
$functions[] = new TwigFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
} | ||
|
||
return $functions; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,13 @@ | |
|
||
use Ivory\GoogleMap\Helper\StaticMapHelper; | ||
use Ivory\GoogleMap\Map; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFunction; | ||
|
||
/** | ||
* @author GeLo <[email protected]> | ||
*/ | ||
class StaticMapExtension extends \Twig_Extension | ||
class StaticMapExtension extends AbstractExtension | ||
{ | ||
/** | ||
* @var StaticMapHelper | ||
|
@@ -40,7 +42,7 @@ public function getFunctions() | |
$functions = []; | ||
|
||
foreach ($this->getMapping() as $name => $method) { | ||
$functions[] = new \Twig_SimpleFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
$functions[] = new TwigFunction($name, [$this, $method], ['is_safe' => ['html']]); | ||
} | ||
|
||
return $functions; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters