Skip to content

Commit c126385

Browse files
committed
Dumper::toPhp() dumps true/false/null in lowercase
1 parent 3ca0d01 commit c126385

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Framework/Dumper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ private static function _toPhp(&$var, &$list = [], $level = 0, &$line = 1)
139139
return strpos($var, '.') === false ? $var . '.0' : $var;
140140

141141
} elseif (is_bool($var)) {
142-
return $var ? 'TRUE' : 'FALSE';
142+
return $var ? 'true' : 'false';
143+
144+
} elseif ($var === null) {
145+
return 'null';
143146

144147
} elseif (is_string($var) && (preg_match('#[^\x09\x20-\x7E\xA0-\x{10FFFF}]#u', $var) || preg_last_error())) {
145148
static $table;

tests/Framework/Dumper.toPhp.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class Test
1414
}
1515

1616

17-
Assert::match('NULL', Dumper::toPhp(null));
18-
Assert::match('TRUE', Dumper::toPhp(true));
19-
Assert::match('FALSE', Dumper::toPhp(false));
17+
Assert::match('null', Dumper::toPhp(null));
18+
Assert::match('true', Dumper::toPhp(true));
19+
Assert::match('false', Dumper::toPhp(false));
2020
Assert::match('0', Dumper::toPhp(0));
2121
Assert::match('1', Dumper::toPhp(1));
2222
Assert::match('0.0', Dumper::toPhp(0.0));
@@ -44,7 +44,7 @@ Assert::match("(object) /* #%a% */ [
4444
]", Dumper::toPhp((object) ['a' => 'b']));
4545

4646
Assert::match("Test::__set_state(/* #%a% */ [
47-
'x' => [10, NULL],
47+
'x' => [10, null],
4848
'y' => 'hello',
4949
'z' => 30.0,
5050
])", Dumper::toPhp(new Test));

0 commit comments

Comments
 (0)