Skip to content

Commit b052a2f

Browse files
authored
Merge pull request #5 from moknomo/patch-1
rm deprecated addIndentation
2 parents 703d444 + 5a45e31 commit b052a2f

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

NodeExpression/Lambda.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,54 @@ protected function compileWithArguments(
1818
{
1919
$compiler->raw("\n");
2020
$compiler->indent();
21-
$compiler->addIndentation();
21+
$compiler->write('');
2222
$compiler->raw("function() use(&\$context) {\n");
2323
$compiler->indent();
2424

2525
// copy of arguments and __ from context
2626
foreach ($arguments as $arg) {
27-
$compiler->addIndentation();
27+
$compiler->write('');
2828
$compiler->raw("if (isset(\$context['$arg'])) \$outer$arg = \$context['$arg'];\n");
2929
}
30-
$compiler->addIndentation();
30+
$compiler->write('');
3131
$compiler->raw("if (isset(\$context['__'])) \$outer__ = \$context['__'];\n");
3232

3333
// adding closure's arguments to context
34-
$compiler->addIndentation();
34+
$compiler->write('');
3535
$compiler->raw("\$context['__'] = func_get_args();\n");
3636
foreach ($arguments as $i => $arg) {
37-
$compiler->addIndentation();
37+
$compiler->write('');
3838
$compiler->raw("if (func_num_args()>$i) \$context['$arg'] = func_get_arg($i);\n");
39-
$compiler->addIndentation();
39+
$compiler->write('');
4040
$compiler->raw("else unset(\$context['$arg']);\n");
4141
}
4242

4343
// getting call result
44-
$compiler->addIndentation();
44+
$compiler->write('');
4545
$compiler->raw("\$result = ");
4646
$compiler->subcompile($this->getNode($expressionNode));
4747
$compiler->raw(";\n");
4848

4949
// recreating original context
5050
foreach ($arguments as $arg) {
51-
$compiler->addIndentation();
51+
$compiler->write('');
5252
$compiler->raw("if (isset(\$outer$arg)) \$context['$arg'] = \$outer$arg ;\n");
53-
$compiler->addIndentation();
53+
$compiler->write('');
5454
$compiler->raw("else unset(\$context['$arg']);\n");
5555
}
56-
$compiler->addIndentation();
56+
$compiler->write('');
5757
$compiler->raw("if (isset(\$outer__)) \$context['__'] = \$outer__ ;\n");
58-
$compiler->addIndentation();
58+
$compiler->write('');
5959
$compiler->raw("else unset(\$context['__']);\n");
6060

6161
// return statement
62-
$compiler->addIndentation();
62+
$compiler->write('');
6363
$compiler->raw("return \$result;\n");
6464
$compiler->outdent();
65-
$compiler->addIndentation();
65+
$compiler->write('');
6666

6767
$compiler->raw("}\n");
6868
$compiler->outdent();
69-
$compiler->addIndentation();
69+
$compiler->write('');
7070
}
7171
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
],
2323
"require": {
2424
"php": "^5.4 || ^7.0",
25-
"twig/twig": "^1.0",
25+
"twig/twig": "^1.0 || ^2.0",
2626
"dpolac/dictionary": "^1.0"
2727
},
2828
"require-dev": {

0 commit comments

Comments
 (0)