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 Apr 29, 2022
1 parent 4f0e466 commit c29b953
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
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 c29b953

Please sign in to comment.