2
2
3
3
namespace TwigCS \Environment ;
4
4
5
- use \Closure ;
6
5
use Symfony \Bridge \Twig \TokenParser \DumpTokenParser ;
7
6
use Symfony \Bridge \Twig \TokenParser \FormThemeTokenParser ;
8
7
use Symfony \Bridge \Twig \TokenParser \StopwatchTokenParser ;
@@ -35,11 +34,6 @@ class StubbedEnvironment extends Environment
35
34
*/
36
35
private $ stubTests ;
37
36
38
- /**
39
- * @var Closure
40
- */
41
- private $ stubCallable ;
42
-
43
37
/**
44
38
* @param LoaderInterface|null $loader
45
39
* @param array $options
@@ -54,6 +48,10 @@ public function __construct(LoaderInterface $loader = null, $options = [])
54
48
$ this ->addTokenParser (new TransChoiceTokenParser ());
55
49
$ this ->addTokenParser (new TransDefaultDomainTokenParser ());
56
50
$ this ->addTokenParser (new TransTokenParser ());
51
+
52
+ $ this ->stubFilters = [];
53
+ $ this ->stubFunctions = [];
54
+ $ this ->stubTests = [];
57
55
}
58
56
59
57
/**
@@ -64,7 +62,7 @@ public function __construct(LoaderInterface $loader = null, $options = [])
64
62
public function getFilter ($ name )
65
63
{
66
64
if (!isset ($ this ->stubFilters [$ name ])) {
67
- $ this ->stubFilters [$ name ] = new TwigFilter ('stub ' , $ this -> stubCallable );
65
+ $ this ->stubFilters [$ name ] = new TwigFilter ('stub ' );
68
66
}
69
67
70
68
return $ this ->stubFilters [$ name ];
@@ -78,7 +76,7 @@ public function getFilter($name)
78
76
public function getFunction ($ name )
79
77
{
80
78
if (!isset ($ this ->stubFunctions [$ name ])) {
81
- $ this ->stubFunctions [$ name ] = new TwigFunction ('stub ' , $ this -> stubCallable );
79
+ $ this ->stubFunctions [$ name ] = new TwigFunction ('stub ' );
82
80
}
83
81
84
82
return $ this ->stubFunctions [$ name ];
@@ -92,7 +90,7 @@ public function getFunction($name)
92
90
public function getTest ($ name )
93
91
{
94
92
if (!isset ($ this ->stubTests [$ name ])) {
95
- $ this ->stubTests [$ name ] = new TwigTest ('stub ' , $ this -> stubCallable );
93
+ $ this ->stubTests [$ name ] = new TwigTest ('stub ' );
96
94
}
97
95
98
96
return $ this ->stubTests [$ name ];
0 commit comments