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

This commit is contained in:
Fabien Potencier
2024-11-29 21:57:12 +01:00
parent 3eed037eed
commit 49f384f107
+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);
}