fixed CS in ExpressionLanguage fixtures

This commit is contained in:
Fabien Potencier 2019-01-16 13:52:19 +01:00
parent ec7dcb2784
commit 25240831e2
6 changed files with 11 additions and 11 deletions

View File

@ -125,7 +125,7 @@ class Compiler
} elseif (\is_bool($value)) {
$this->raw($value ? 'true' : 'false');
} elseif (\is_array($value)) {
$this->raw('array(');
$this->raw('[');
$first = true;
foreach ($value as $key => $value) {
if (!$first) {
@ -136,7 +136,7 @@ class Compiler
$this->raw(' => ');
$this->repr($value);
}
$this->raw(')');
$this->raw(']');
} else {
$this->string($value);
}

View File

@ -41,9 +41,9 @@ class ArrayNode extends Node
*/
public function compile(Compiler $compiler)
{
$compiler->raw('array(');
$compiler->raw('[');
$this->compileArguments($compiler);
$compiler->raw(')');
$compiler->raw(']');
}
public function evaluate($functions, $values)

View File

@ -38,7 +38,7 @@ class ArrayNodeTest extends AbstractNodeTest
public function getCompileData()
{
return [
['array("b" => "a", 0 => "b")', $this->getArrayNode()],
['["b" => "a", 0 => "b"]', $this->getArrayNode()],
];
}

View File

@ -104,10 +104,10 @@ class BinaryNodeTest extends AbstractNodeTest
['pow(5, 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))],
['("a" . "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))],
['in_array("a", array(0 => "a", 1 => "b"))', new BinaryNode('in', new ConstantNode('a'), $array)],
['in_array("c", array(0 => "a", 1 => "b"))', new BinaryNode('in', new ConstantNode('c'), $array)],
['!in_array("c", array(0 => "a", 1 => "b"))', new BinaryNode('not in', new ConstantNode('c'), $array)],
['!in_array("a", array(0 => "a", 1 => "b"))', new BinaryNode('not in', new ConstantNode('a'), $array)],
['in_array("a", [0 => "a", 1 => "b"])', new BinaryNode('in', new ConstantNode('a'), $array)],
['in_array("c", [0 => "a", 1 => "b"])', new BinaryNode('in', new ConstantNode('c'), $array)],
['!in_array("c", [0 => "a", 1 => "b"])', new BinaryNode('not in', new ConstantNode('c'), $array)],
['!in_array("a", [0 => "a", 1 => "b"])', new BinaryNode('not in', new ConstantNode('a'), $array)],
['range(1, 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))],

View File

@ -37,7 +37,7 @@ class ConstantNodeTest extends AbstractNodeTest
['3', new ConstantNode(3)],
['3.3', new ConstantNode(3.3)],
['"foo"', new ConstantNode('foo')],
['array(0 => 1, "b" => "a")', new ConstantNode([1, 'b' => 'a'])],
['[0 => 1, "b" => "a"]', new ConstantNode([1, 'b' => 'a'])],
];
}

View File

@ -39,7 +39,7 @@ class GetAttrNodeTest extends AbstractNodeTest
['$foo->foo', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), ['foo' => new Obj()]],
['$foo->foo(array("b" => "a", 0 => "b"))', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]],
['$foo->foo(["b" => "a", 0 => "b"])', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]],
['$foo[$index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)],
];
}