mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 03:57:21 +00:00
Remove usage of list() in favor of []
This commit is contained in:
@@ -48,7 +48,7 @@ class SetNode extends Node implements NodeCaptureInterface
|
||||
$compiler->addDebugInfo($this);
|
||||
|
||||
if (\count($this->getNode('names')) > 1) {
|
||||
$compiler->write('list(');
|
||||
$compiler->write('[');
|
||||
foreach ($this->getNode('names') as $idx => $node) {
|
||||
if ($idx) {
|
||||
$compiler->raw(', ');
|
||||
@@ -56,7 +56,7 @@ class SetNode extends Node implements NodeCaptureInterface
|
||||
|
||||
$compiler->subcompile($node);
|
||||
}
|
||||
$compiler->raw(')');
|
||||
$compiler->raw(']');
|
||||
} else {
|
||||
$compiler->subcompile($this->getNode('names'), false);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ EOF
|
||||
$node = new SetNode(false, $names, $values, 1);
|
||||
$tests[] = [$node, <<<EOF
|
||||
// line 1
|
||||
list(\$context["foo"], \$context["bar"]) = ["foo", {$this->getVariableGetter('bar')}];
|
||||
[\$context["foo"], \$context["bar"]] = ["foo", {$this->getVariableGetter('bar')}];
|
||||
EOF
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user