Skip to content

Commit 1a08b08

Browse files
committed
renamed environment & staticEnvironment to variable & staticVariables
1 parent c05a1a3 commit 1a08b08

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

performance/CompiledThemeTestTemplate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function stream(array $assigns = []): void
5151
protected function buildContext(array $assigns = []): RenderContext
5252
{
5353
return $this->environment->newRenderContext(
54-
staticEnvironment: $assigns,
54+
staticVariables: $assigns,
5555
);
5656
}
5757
}

src/Environment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public function newRenderContext(
6363
*
6464
* @var array<string, mixed> $environment
6565
*/
66-
array $environment = [],
66+
array $variables = [],
6767
/**
6868
* Environment variables that are shared with all sub-contexts
6969
*
7070
* @var array<string, mixed> $staticEnvironment
7171
*/
72-
array $staticEnvironment = [],
72+
array $staticVariables = [],
7373
/**
7474
* Registers allows to provide/export data or utilities inside tags
7575
* Registers are not accessible as variables.
@@ -82,8 +82,8 @@ public function newRenderContext(
8282
?ResourceLimits $resourceLimits = null,
8383
): RenderContext {
8484
return new RenderContext(
85-
variables: $environment,
86-
staticVariables: $staticEnvironment,
85+
variables: $variables,
86+
staticVariables: $staticVariables,
8787
registers: $registers,
8888
profile: $this->profile,
8989
options: $options ?? $this->defaultRenderContextOptions,

tests/Integration/ErrorHandlingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
$template = $environment->parseString("Argument error:\n{% render 'product' with errors %}");
180180

181181
$output = $template->render($environment->newRenderContext(
182-
staticEnvironment: ['errors' => new ErrorDrop],
182+
staticVariables: ['errors' => new ErrorDrop],
183183
));
184184

185185
expect($output)

tests/Integration/OutputTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
->registerFilters(FunnyFilter::class)
3737
->build();
3838
$context = $environment->newRenderContext(
39-
staticEnvironment: $this->assigns,
39+
staticVariables: $this->assigns,
4040
);
4141

4242
expect($environment->parseString(' {{ car.gm | make_funny }} ')->render($context))
@@ -48,7 +48,7 @@
4848
->registerFilters(FunnyFilter::class)
4949
->build();
5050
$context = $environment->newRenderContext(
51-
staticEnvironment: $this->assigns,
51+
staticVariables: $this->assigns,
5252
);
5353

5454
expect($environment->parseString(' {{ car.gm | cite_funny }} ')->render($context))
@@ -60,7 +60,7 @@
6060
->registerFilters(FunnyFilter::class)
6161
->build();
6262
$context = $environment->newRenderContext(
63-
staticEnvironment: $this->assigns,
63+
staticVariables: $this->assigns,
6464
);
6565

6666
expect($environment->parseString(" {{ car.gm | add_smiley : ':-(' }} ")->render($context))
@@ -72,7 +72,7 @@
7272
->registerFilters(FunnyFilter::class)
7373
->build();
7474
$context = $environment->newRenderContext(
75-
staticEnvironment: $this->assigns,
75+
staticVariables: $this->assigns,
7676
);
7777

7878
expect($environment->parseString(' {{ car.gm | add_smiley }} ')->render($context))
@@ -84,7 +84,7 @@
8484
->registerFilters(FunnyFilter::class)
8585
->build();
8686
$context = $environment->newRenderContext(
87-
staticEnvironment: $this->assigns,
87+
staticVariables: $this->assigns,
8888
);
8989

9090
expect($environment->parseString(" {{ car.gm | add_smiley : ':-(' | add_smiley : ':-('}} ")->render($context))
@@ -96,7 +96,7 @@
9696
->registerFilters(FunnyFilter::class)
9797
->build();
9898
$context = $environment->newRenderContext(
99-
staticEnvironment: $this->assigns,
99+
staticVariables: $this->assigns,
100100
);
101101

102102
expect($environment->parseString(" {{ car.gm | add_tag : 'span', 'bar'}} ")->render($context))
@@ -108,7 +108,7 @@
108108
->registerFilters(FunnyFilter::class)
109109
->build();
110110
$context = $environment->newRenderContext(
111-
staticEnvironment: $this->assigns,
111+
staticVariables: $this->assigns,
112112
);
113113

114114
expect($environment->parseString(" {{ car.gm | add_tag : 'span', car.bmw}} ")->render($context))
@@ -120,7 +120,7 @@
120120
->registerFilters(FunnyFilter::class)
121121
->build();
122122
$context = $environment->newRenderContext(
123-
staticEnvironment: ['best_cars' => 'bmw']
123+
staticVariables: ['best_cars' => 'bmw']
124124
);
125125

126126
expect($environment->parseString(' {{ best_cars | cite_funny | paragraph }} ')->render($context))
@@ -133,7 +133,7 @@
133133
->build();
134134

135135
$context = $environment->newRenderContext(
136-
staticEnvironment: $this->assigns,
136+
staticVariables: $this->assigns,
137137
);
138138

139139
expect($environment->parseString(" {{ 'Typo' | link_to: 'http://typo.leetsoft.com' }} ")->render($context))

tests/Integration/ProfilerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function profileTemplate(string $source, array $assigns = []): ?Profiler
196196
$environment = $factory->setProfile()->build();
197197
$template = $environment->parseString($source);
198198
$template->render($environment->newRenderContext(
199-
staticEnvironment: $assigns,
199+
staticVariables: $assigns,
200200
));
201201

202202
return $template->getProfiler();

tests/Integration/TemplateTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136

137137
$template = parseTemplate('{{x}} {{y}} {{z.a}} {{z.b}} {{z.c.d}}');
138138
$context = $environment->newRenderContext(
139-
staticEnvironment: [
139+
staticVariables: [
140140
'x' => 33,
141141
'z' => ['a' => 32, 'c' => ['e' => 31]],
142142
],
@@ -190,7 +190,7 @@
190190

191191
$template = parseTemplate('{{ d.text }} {{ d.undefined }}');
192192
$context = $environment->newRenderContext(
193-
staticEnvironment: [
193+
staticVariables: [
194194
'd' => new \Keepsuit\Liquid\Tests\Stubs\TextDrop,
195195
],
196196
);
@@ -217,7 +217,7 @@
217217

218218
$template = parseTemplate('{{ d.text }} {{ d.undefined }}');
219219
$context = $environment->newRenderContext(
220-
staticEnvironment: [
220+
staticVariables: [
221221
'd' => new \Keepsuit\Liquid\Tests\Stubs\TextDrop,
222222
],
223223
);
@@ -240,7 +240,7 @@
240240

241241
$template = parseTemplate('{{a}} {{x | upcase | somefilter1 | somefilter2 | capitalize}}', $environment);
242242
$context = $environment->newRenderContext(
243-
staticEnvironment: [
243+
staticVariables: [
244244
'a' => 123,
245245
'x' => 'foo',
246246
],
@@ -270,7 +270,7 @@
270270

271271
$template = parseTemplate('{{a}} {{x | upcase | somefilter1 | somefilter2 | capitalize}}');
272272
$context = $environment->newRenderContext(
273-
staticEnvironment: [
273+
staticVariables: [
274274
'a' => 123,
275275
'x' => 'foo',
276276
],

tests/Pest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function buildRenderContext(
3030
?Environment $environment = null
3131
) {
3232
$context = ($environment ?? Environment::default())->newRenderContext(
33-
staticEnvironment: $assigns,
33+
staticVariables: $assigns,
3434
);
3535

3636
foreach ($registers as $key => $value) {

0 commit comments

Comments
 (0)