Skip to content

Commit 31155b8

Browse files
committed
dumps true/false/null in lowercase
1 parent a516630 commit 31155b8

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

src/PhpGenerator/Helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ private static function _dump(&$var, int $level = 0)
4545
}
4646
return str_replace('.0', '', var_export($var, true)); // workaround for PHP 7.0.2
4747

48-
} elseif (is_bool($var)) {
49-
return $var ? 'TRUE' : 'FALSE';
48+
} elseif ($var === null) {
49+
return 'null';
5050

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

tests/PhpGenerator/ClassType.expect

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ abstract final class Example extends ParentClass implements IExample, IOne
1212
}
1313

1414
const ROLE = 'admin';
15-
const ACTIVE = FALSE;
15+
const ACTIVE = false;
1616
/** Commented */
1717
private const FORCE_ARRAY = Nette\Utils\Json::FORCE_ARRAY;
1818

@@ -21,7 +21,7 @@ abstract final class Example extends ParentClass implements IExample, IOne
2121

2222
public $order = RecursiveIteratorIterator::SELF_FIRST;
2323

24-
public static $sections = ['first' => TRUE];
24+
public static $sections = ['first' => true];
2525

2626

2727
/**
@@ -41,6 +41,6 @@ abstract final class Example extends ParentClass implements IExample, IOne
4141
}
4242

4343

44-
abstract public function show($item, array &$res = NULL);
44+
abstract public function show($item, array &$res = null);
4545

4646
}

tests/PhpGenerator/ClassType.from.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Class2 extends Class1 implements Interface2
4848
* Func3
4949
* @return Class1
5050
*/
51-
private function &func3(array $a%a?%, Class2 $b = NULL, Unknown $c, \Xyz\Unknown $d, callable $e, $f = Abc\Unknown::ABC, $g)
51+
private function &func3(array $a%a?%, Class2 $b = null, Unknown $c, \Xyz\Unknown $d, callable $e, $f = Abc\Unknown::ABC, $g)
5252
{
5353
}
5454

tests/PhpGenerator/ClassType.from.php71.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class ClassA
22
{
33

4-
public function func1(A $a, ?B $b, C $c = NULL, D $d = NULL, E $e, ?int $i = 1, ?array $arr = [])
4+
public function func1(A $a, ?B $b, C $c = null, D $d = null, E $e, ?int $i = 1, ?array $arr = [])
55
{
66
}
77

tests/PhpGenerator/Closure.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ Assert::exception(function () {
4747
$closure = function (stdClass $a, $b = null) {};
4848
$function = Closure::from($closure);
4949
Assert::match(
50-
'function (stdClass $a, $b = NULL) {
50+
'function (stdClass $a, $b = null) {
5151
}', (string) $function);

tests/PhpGenerator/GlobalFunction.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ Assert::match(
2020
'/**
2121
* global
2222
*/
23-
function func(stdClass $a, $b = NULL)
23+
function func(stdClass $a, $b = null)
2424
{
2525
}', (string) $function);

tests/PhpGenerator/Helpers.dump().phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Assert::same('0.1', Helpers::dump(0.1));
2323
Assert::same('INF', Helpers::dump(INF));
2424
Assert::same('-INF', Helpers::dump(-INF));
2525
Assert::same('NAN', Helpers::dump(NAN));
26-
Assert::same('NULL', Helpers::dump(null));
27-
Assert::same('TRUE', Helpers::dump(true));
28-
Assert::same('FALSE', Helpers::dump(false));
26+
Assert::same('null', Helpers::dump(null));
27+
Assert::same('true', Helpers::dump(true));
28+
Assert::same('false', Helpers::dump(false));
2929

3030
Assert::same("''", Helpers::dump(''));
3131
Assert::same("'Hello'", Helpers::dump('Hello'));

0 commit comments

Comments
 (0)