We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5f8a000 + aaaa634 commit a2f6e0aCopy full SHA for a2f6e0a
src/Mapping/Field/ConstantValueMapper.php
@@ -47,9 +47,30 @@ public function compile(Node\Expr $outputNode): array
47
new Node\Stmt\Expression(
48
new Node\Expr\Assign(
49
$outputNode,
50
- new Node\Scalar\String_($this->value)
+ $this->compileValue($this->value)
51
),
52
53
];
54
}
55
+
56
+ public function compileValue(mixed $value): Node\Expr
57
+ {
58
+ if ($value === true) {
59
+ return new Node\Expr\ConstFetch(
60
+ name: new Node\Name(name: 'true'),
61
+ );
62
+ }
63
64
+ if ($value === false) {
65
66
+ name: new Node\Name(name: 'false'),
67
68
69
70
+ if (is_int($value)) {
71
+ return new Node\Scalar\LNumber(value: $value);
72
73
74
+ return new Node\Scalar\String_(value: $value);
75
76
0 commit comments