minor #4486 Use [] instead of array() to represent a constant value in compiled code (fabpot)

This PR was merged into the 3.x branch.

Discussion
----------

Use [] instead of array() to represent a constant value in compiled code

Commits
-------

49f384f107 Use [] instead of array() to represent a constant value in compiled code
This commit is contained in:
Fabien Potencier
2024-11-30 09:30:56 +01:00
+2 -2
View File
@@ -170,7 +170,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 => $v) {
if (!$first) {
@@ -181,7 +181,7 @@ class Compiler
$this->raw(' => ');
$this->repr($v);
}
$this->raw(')');
$this->raw(']');
} else {
$this->string($value);
}