Skip to content

Commit 92a7255

Browse files
committed
Replace deprecated methods as of Twig 2.7
1 parent 7d10f30 commit 92a7255

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/Twig.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class Twig implements \ArrayAccess
2424
/**
2525
* Twig loader
2626
*
27-
* @var \Twig_LoaderInterface
27+
* @var \Twig\Loader\LoaderInterface
2828
*/
2929
protected $loader;
3030

3131
/**
3232
* Twig environment
3333
*
34-
* @var \Twig_Environment
34+
* @var \Twig\Environment
3535
*/
3636
protected $environment;
3737

@@ -55,7 +55,7 @@ class Twig implements \ArrayAccess
5555
public function __construct($path, $settings = [])
5656
{
5757
$this->loader = $this->createLoader(is_string($path) ? [$path] : $path);
58-
$this->environment = new \Twig_Environment($this->loader, $settings);
58+
$this->environment = new \Twig\Environment($this->loader, $settings);
5959
}
6060

6161
/********************************************************************************
@@ -65,9 +65,9 @@ public function __construct($path, $settings = [])
6565
/**
6666
* Proxy method to add an extension to the Twig environment
6767
*
68-
* @param \Twig_ExtensionInterface $extension A single extension instance or an array of instances
68+
* @param \Twig\Extension\ExtensionInterface $extension A single extension instance or an array of instances
6969
*/
70-
public function addExtension(\Twig_ExtensionInterface $extension)
70+
public function addExtension(\Twig\Extension\ExtensionInterface $extension)
7171
{
7272
$this->environment->addExtension($extension);
7373
}
@@ -138,11 +138,11 @@ public function render(ResponseInterface $response, $template, $data = [])
138138
* Create a loader with the given path
139139
*
140140
* @param array $paths
141-
* @return \Twig_Loader_Filesystem
141+
* @return \Twig\Loader\FilesystemLoader
142142
*/
143143
private function createLoader(array $paths)
144144
{
145-
$loader = new \Twig_Loader_Filesystem();
145+
$loader = new \Twig\Loader\FilesystemLoader();
146146

147147
foreach ($paths as $namespace => $path) {
148148
if (is_string($namespace)) {
@@ -162,7 +162,7 @@ private function createLoader(array $paths)
162162
/**
163163
* Return Twig loader
164164
*
165-
* @return \Twig_LoaderInterface
165+
* @return \Twig\Loader\LoaderInterface
166166
*/
167167
public function getLoader()
168168
{
@@ -172,7 +172,7 @@ public function getLoader()
172172
/**
173173
* Return Twig environment
174174
*
175-
* @return \Twig_Environment
175+
* @return \Twig\Environment
176176
*/
177177
public function getEnvironment()
178178
{

src/TwigExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
namespace Slim\Views;
1010

11-
class TwigExtension extends \Twig_Extension
11+
class TwigExtension extends \Twig\Extension\AbstractExtension
1212
{
1313
/**
1414
* @var \Slim\Interfaces\RouterInterface
@@ -34,10 +34,10 @@ public function getName()
3434
public function getFunctions()
3535
{
3636
return [
37-
new \Twig_SimpleFunction('path_for', array($this, 'pathFor')),
38-
new \Twig_SimpleFunction('base_url', array($this, 'baseUrl')),
39-
new \Twig_SimpleFunction('is_current_path', array($this, 'isCurrentPath')),
40-
new \Twig_SimpleFunction('current_path', array($this, 'currentPath')),
37+
new \Twig\TwigFunction('path_for', array($this, 'pathFor')),
38+
new \Twig\TwigFunction('base_url', array($this, 'baseUrl')),
39+
new \Twig\TwigFunction('is_current_path', array($this, 'isCurrentPath')),
40+
new \Twig\TwigFunction('current_path', array($this, 'currentPath')),
4141
];
4242
}
4343

0 commit comments

Comments
 (0)