Skip to content

Commit

Permalink
Update Twig extensions to work with Twig v3
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasruunu committed May 20, 2022
1 parent 4f0e466 commit a5ed707
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Include the Google Analytics Async template in the `head` tag or just before the
With twig:

```twig
{% include "GoogleBundle:Analytics:async.html.twig" %}
{% include "@Google/Analytics/async.html.twig" %}
```

#### Features
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
}
],
"require": {
"php": "^7.2",
"php": ">=7.2",
"twig/twig": "^2.0|^3.0",
"symfony/dependency-injection": "^3.4 || ^4.4 || ^5.0",
"symfony/http-kernel": "^3.4 || ^4.4 || ^5.0",
"symfony/config": "^3.4 || ^4.4 || ^5.0"
Expand Down
7 changes: 4 additions & 3 deletions src/Extension/AdwordsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use AntiMattr\GoogleBundle\Helper\AdwordsHelper;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class AdwordsExtension extends AbstractExtension implements \Twig_Extension_GlobalsInterface
class AdwordsExtension extends AbstractExtension implements GlobalsInterface
{
private $adwordsHelper;

Expand All @@ -14,7 +15,7 @@ public function __construct(AdwordsHelper $adwordsHelper)
$this->adwordsHelper = $adwordsHelper;
}

public function getGlobals()
public function getGlobals(): array
{
return [
'google_adwords' => $this->adwordsHelper,
Expand All @@ -26,7 +27,7 @@ public function getGlobals()
*
* @return string The extension name
*/
public function getName()
public function getName(): string
{
return 'google_adwords';
}
Expand Down
7 changes: 4 additions & 3 deletions src/Extension/AnalyticsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use AntiMattr\GoogleBundle\Helper\AnalyticsHelper;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class AnalyticsExtension extends AbstractExtension implements \Twig_Extension_GlobalsInterface
class AnalyticsExtension extends AbstractExtension implements GlobalsInterface
{
private $analyticsHelper;

Expand All @@ -14,7 +15,7 @@ public function __construct(AnalyticsHelper $analyticsHelper)
$this->analyticsHelper = $analyticsHelper;
}

public function getGlobals()
public function getGlobals(): array
{
return [
'google_analytics' => $this->analyticsHelper,
Expand All @@ -26,7 +27,7 @@ public function getGlobals()
*
* @return string The extension name
*/
public function getName()
public function getName(): string
{
return 'google_analytics';
}
Expand Down
7 changes: 4 additions & 3 deletions src/Extension/MapsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use AntiMattr\GoogleBundle\Helper\MapsHelper;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

class MapsExtension extends AbstractExtension implements \Twig_Extension_GlobalsInterface
class MapsExtension extends AbstractExtension implements GlobalsInterface
{
private $mapsHelper;

Expand All @@ -14,7 +15,7 @@ public function __construct(MapsHelper $mapsHelper)
$this->mapsHelper = $mapsHelper;
}

public function getGlobals()
public function getGlobals(): array
{
return [
'google_maps' => $this->mapsHelper,
Expand All @@ -26,7 +27,7 @@ public function getGlobals()
*
* @return string The extension name
*/
public function getName()
public function getName(): string
{
return 'google_maps';
}
Expand Down
7 changes: 4 additions & 3 deletions src/Extension/TagManagerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use AntiMattr\GoogleBundle\Helper\TagManagerHelper;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

/**
* Tag Manager Extension
*/
class TagManagerExtension extends AbstractExtension implements \Twig_Extension_GlobalsInterface
class TagManagerExtension extends AbstractExtension implements GlobalsInterface
{
private $tagManagerHelper;

Expand All @@ -23,7 +24,7 @@ public function __construct(TagManagerHelper $tagManagerHelper)
/**
* @return array
*/
public function getGlobals()
public function getGlobals(): array
{
return [
'google_tag_manager' => $this->tagManagerHelper,
Expand All @@ -35,7 +36,7 @@ public function getGlobals()
*
* @return string The extension name
*/
public function getName()
public function getName(): string
{
return 'google_tag_manager';
}
Expand Down

0 comments on commit a5ed707

Please sign in to comment.